How can I get an image from an Android ImageView using Python Appium? This image should be in PNG format.
I want to test if an icon has the correct image and I fail to use the method find_element_by_image provided by Appium.
The screenshot method doesn't seem to be ideal for me because it takes a screenshot instead of giving me the original image, which would contain the white background while the original image doesn't have it.
Although I didn't find a way to get the image but I have found a workaround to test the images.
You can use element.screenshot(path) to save the correct images to a local folder. (of course use find_element_by_something to get the element) Then save the images to compare using element.screenshot(temp_path).
Finally, from PIL import Image, ImageChops and use ImageChops.difference(Image.open(path1), Image.open(path2)) is None for image comparison. The expression returns True if they match pixelwise.
Python Appium Get Image from Android ImageView