← Back to team overview

sikuli-driver team mailing list archive

[Question #677380]: scroll down a page with findAll list

 

New question #677380 on Sikuli:
https://answers.launchpad.net/sikuli/+question/677380

This is my basic code so far:

What I am trying to do is scroll down a long page of
Buttons, click the button and look for an order code number
in the pop up window.  Then close the pop up window
and go to the next button and click it, and so on ....

The code below works OK for only those buttons that
are on screen initially.   The problem is if I try scrolling
and then do another list(findAll   all of the positions
of the buttons are shifted, and Sikuli clicks but in the
wrong position.
Any help you can give me would be much appreciated.
Thanks.

tbutt = 0

tbuttons = list(findAll("morebutton.png"))
print "I Found ",len(tbuttons)," matches"
tbuttsorted = sorted(tbuttons,key=lambda m:m.y)

for tbutt in tbuttsorted:
    print "Going to click this more button"
    hover(tbutt)

    mouseDown(Button.LEFT)
    mouseUp(Button.LEFT)

    sleep(1)

    try:
        find(Pattern("ordercodedmg290.png").similar(0.99))
        print "Found Order Code DMG290"
        print "I am going with this one ", tbutt
        mouseDown(Button.RIGHT)
        mouseUp(Button.RIGHT)
        mouseDown(Button.LEFT)
        mouseUp(Button.LEFT)

        break
    except FindFailed:
        print "Did NOT Find Order Code DMG290"
        print "Going to try the next more button"

        mouseDown(Button.RIGHT)
        mouseUp(Button.RIGHT)
        mouseDown(Button.LEFT)
        mouseUp(Button.LEFT)

hover(tbutt)

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