← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #225917]: For loop not breaking in java

 

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

Description changed to:
I am trying to delete rows in a queue via an iOS app. I press edit and
the trash icon appear, and then I have sikuli select those icons to
remove. Seems pretty straight forward and sikuli is really good at doing
that . The trick in my case is that the list is dynamic and I never know
how many rows will be visible in that queue so I created a For loop in
java.

The loop does not seem to be breaking, Here is my code:

	@Test
	public void testDeleteTrashIcon() throws Exception {
				
		for (int i = 0; i < 10; i++) {

			s.wait("imgs/TrashIcon.png", 10);
			s.click("imgs/TrashIcon.png", 0);
			
			if (s.exists("imgs/ConfirmDeletionOfTrashIcons.png", 0) != null) {
				break;
			}
		}
	} 


So here is the scenario in this one instance:
-there is a 2 rows displaying trash icon
-the loop I have set can delete up to 10
- the method above does not recognize the IF statement in the loop and gives me "FindFailed: can not find imgs/TrashIcon.png because its still trying to finish all 10 


can someone tell me where I have written this incorrectly? or another
way to have sikuli loop until another image appears using java?

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.