← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #275951]: Adding logic via IF, ELSE statement in Sikuli Java API using the exist method

 

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

RaiMan proposed the following answer:
if (s.exists(imagePath1) != null))
   s.click() // clicks the last match in s
else if (s.exists(imagePath2) != null)
   s.click() // clicks the last match in s
else if (s.exists(imagePath3) != null)
   s.click() // clicks the last match in s
else
   System.exit(1) # none found, you might issue some log before

BeAware:
- the first found image wins
- each search lasts 3 seconds if not found (so max for the 3 is 9 secs)

You might use 
exists(image, 0)
if you are sure, that at least one of the images should be on the screen.

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