← Back to team overview

sikuli-driver team mailing list archive

[Question #406534]: For loop not executing if statement in Java

 

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

I have created an infinite loop which clicks a "spin" button in an online game and I am waiting for the balance to be too low for the user to spin, in which the spin button becomes inaccessible. Everything is working smoothly until the spin button becomes inaccessible for the application to click, in which the code does not access the if statement but I'm not too sure why.

Here is my code:

   for(;;) {
   
   screen.click(screen.wait(spinButton, 20), 0);

   if (screen.exists(spinButton, 1) == null) {
   driver.navigate().refresh();   
   }
}

So the screen click on the spinButton is looping here, and then I've added an if statement for when it becomes un-clickable (spinButton == null) - but however the if statement is not executed, the loop just keeps trying to look for the spinButton then eventually fails.

Could anyone possibly assist me with this and guide me in the right direction? Would be much appreciated.

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