sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #04685
Re: [Question #168311]: Exists return no value even though the image is present on the screen
Question #168311 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/168311
Status: Open => Answered
RaiMan proposed the following answer:
if in doubt about need to insert some waiting (which is most probable in
your situation):
If exists(<image of 1.png>, 5):
do something
else:
do something
pass # next statement
the semantic of this construct:
- continuously search for <image of 1.png>
- if it cannot be found within 5 seconds, "do something" as scripted in the else: branch
- if it is found within 5 seconds, "do something" as scripted in the if: branch and then skip the else: branch
- in any case after having done either else: branch or if: branch continue with "pass # next statement"
tip: in the if: branch you can e.g. use click(getLastMatch()), because
Sikuli always remembers the last successful find action (the exists()
in this case). so you would not need another find operation on the same
image.
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.