python + Appium Automation: Screenshots

Screenshots

The main is to program error, can be developed in addition to the analysis of the log, also can capture better to locate the problem.

Screenshots There are two general methods:

The first save_screenshot (self, filename)

driver.back()

driver.save_screenshot('toast.png')

 

 

Save to current folder

The second get_screenshot_as_file (self, filename)

#save route
driver.get_screenshot_as_file('C:\\Users\\PycharmProjects\\Appiumtaobao\\case\\image\\toast.png')

# Can also write Chinese path, but in front of the best add a "u", to prevent the error

Guess you like

Origin www.cnblogs.com/bugbreak/p/12048378.html