← Back to team overview

sikuli-driver team mailing list archive

[Question #274061]: How to Set Up a Basic Loop

 

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

Hello,

I am trying to set up a basic script that will click on a group of icons and do some tasks. I have a page with a list of maps (3 columns, with about 20 maps in each column), each building map has the same button next to it. When you double-click that button, a new page opens that has a map of that building. I would like my script to double-click the icon, print the map to PDF, then go back to the main page and do the same for all the other maps.

I was able to get Sikuli to perform the task for 1 map. In other words, I got it to locate the button, click it, print the map to PDF, and then go back to the main page. However, when I try to set up a loop, it does not work as expected. What is the best way to set up the loop. I have the following:

for x in findAll("1447248227901.png"):
    doubleClick(x)
    wait(5)
    p = find("1447248404826.png")
    click(p)
    c = find("1447248767352.png")
    click(c)
    b = find("1447248503976.png")
    click(b)

When I run the script, here is what happens:
The first button is located (correctly) and double-clicked
The maps loads
The script waits 5 seconds (correctly)
clicks p and c are performed (correctly)
click b is performed and the main page loads again
INSTEAD of the second button being located (i.e. the next x in my findall command), instead the script looks for p and performs click(p)

So basically, how do I get it to locate the next button (or next x in my findall) and loop through these commands again?

Any help is greatly appreciated!

Thanks,


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