use adb command for save a screenshot file. (I want remove blue cursor from .save_screenshot() )
os.system(“adb shell screencap -p /sdcard/screenshot.png”)
os.system(“adb pull /sdcard/screenshot.png screenshot.png”)
and use tesseract library for convert image to text
pytesseract.pytesseract.tesseract_cmd = 'tesseract.exe'
im = Image.open("screenshot.png")
im3 = im.resize((x*3, y*3), Image.ANTIALIAS)
im4 = im3.convert('L')
text = pytesseract.image_to_string(im4)
text=''.join(filter(lambda x: x in string.printable, text))
and assert
assert ‘True’==str(error1 in text))