I am trying to automate taking screenshot and uploading via photo album in iOS Simulator. If we use Appium save_screenshot(output), we don't know the photo album path or don't have permissions to write explicitly in to the Photo Album. Instead we are forced to save the screen shot to a path in our computer/project.
I have tried these two:
.
screenshotBase64 = self.driver.get_screenshot_as_base64()
file = ((TakesScreenshot)self.driver).getScreenshotAs(OutputType.FILE);
Expected: Screenshot taken and saved into the photo Album Actual: Nothing happens
There is no single command for this, you will have to go for the following combination:
Like:
screenshotBase64 = self.driver.get_screenshot_as_base64()
driver.push_file('/path/to/device/foo.bar', screenshotBase64)
You might also be interested in SeeTest - Appium Extension commands which fill Appium's gaps
You could use the driver to save the screenshot as a file:
self.wd = webdriver.Remote('http://localhost:{0}/wd/hub'.format(self.port), self.desired_caps)
self.wd.get_screenshot_as_file('{0}.jpg'.format(self.desired_caps['deviceName']))
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.