← Back to team overview

sikuli-driver team mailing list archive

[Question #678325]: If it Can't Find, Closes Early

 

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

I'm trying to make something simple for a game. sometimes a button randomly appears in intervals between 5 and 500 seconds. I want it to detect and click the button within 10 seconds, but to not click if the button doesn't exist. Yet if I try something like:

while has(randomButtonImage):
    click(randomButtonImage)

If the button isn't already up, the program closes saying findfailed. if the button is up and I open the program, it goes to the button, clicks it a few times(even after it has disappeared), and then when the button is gone from being clicked the program terminates because it says findfailed. 

All I want it to do is click the button once when it exists (and then the button goes away), and then to keep searching for the button until it comes up again (but not clicking unless it exists, and to stop terminating if the image doesn't exist). 

Thanks for any help.



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