sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #58690
Re: [Question #705665]: The exists() parameter is set to the image file path and does not work
Question #705665 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/705665
Status: Open => Answered
RaiMan proposed the following answer:
if exists(Sd_img_L):
SD = find(Sd_img_L)
click(SD)
With this code, nothing happens at all, if the image does not appear
within 3 seconds (standard wait time), because exists returns None in
this case and the if branch is skipped.
If you want to know about Not-Found, you have to add an else branch.
A shorter snippet is this with the same effect as your if construct:
click(exists(Sd_img_L))
If the image appears within 3 seconds, it is clicked, else nothing
happens at all.
with click(exists(Sd_img_L, 0)) there will be only one search - hence no
wait for the image.
If you only wanted to know wether the click happens or not:
if not click(exists(Sd_img_L, 0)): print "not clicked"
--
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.