How to Set Up a Basic Loop
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(
doubleClick(x)
wait(5)
p = find("144724840
click(p)
c = find("144724876
click(c)
b = find("144724850
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 (correctly)
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), which is not the desired behavior.
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,
Question information
- Language:
- English Edit question
- Status:
- Answered
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Moneer for more information if necessary.