1

I want to capture screenshots by elements in appium similar to the one in selenium. I am using python. Could not find much about this, is there any way to achieve this?

2 Answers 2

1

I think you can use the Appium driver.get_screenshot_as_base64() command described in the documentation: http://appium.io/docs/en/commands/session/screenshot/

Now you should have a screenshot of the full page. You can ask the element its location and crop the screenshot. This is described for Python and Selenium in detail here: https://stackoverflow.com/questions/15018372/how-to-take-partial-screenshot-with-selenium-webdriver-in-python

Although I didnt try it myself I think the cropping should work the same for Appuim based elements and screenshots.

0

This post is a little old, but for everyone else who ends up here appium does have this built in.

First find the element you want to screenshot (you can use the self.driver.find_element() function). Then the web element returned has different properties including "screenshot_as_png".

There are several options in my autocomplete (but I didn't see any documentation readily available but I did find https://stackoverflow.com/a/47959716/20523639):

  • Function: screenshot()
  • attribute: screenshot_as_base64
  • attribute: screenshot_as_png

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.