← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #676778]: Looping through list of elements and finind expected text with OCR

 

Question #676778 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/676778

Rares Pasca posted a new comment:
This is my solution for this, i hope it will work on you aswell.

Here are the elements passed to the method:
myRegion = your region where you want to scroll
expectedStringElement = the text that is found on the element you want to click for example "Create Account"
elementToClick = define an image containing the element that you want to click for example "Create Account" button image

    def findElementFromList(myRegion,expectedStringElement,elementToClick):
        hover(myRegion)
        scrollIncrement = 0   
        while scrollIncrement < 10:
            wheel(WHEEL_DOWN, scrollIncrement)
            myTextFromScreen = Region.text(MyRegion)
            if expectedStringElementElement in myTextFromScreen:
                click(elementToClick)
                break
            scrollIncrement += 1

Struggled a bit to make it work, maybe because of my app that I'm
testing but in the end very helpful and reusable evrey time is needed.

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.