How to perform an action after .wait() does not find image?

Asked by bphand

The summary is this: (I am using Java, by the way)
I want to wait for an image. I use screen.wait(image,time) to achieve this. Sometimes the image is not found after this wait period. I want to continue to run code after this by saying ( if image not found, then do something). However, it just says "image not found" in the console and stops the test if the image is not found. I want to be able to do a screen.exists comparison to say what to do if the image is not found, but the test simply fails if the image is not found.

How do I continue to run code after an image is not found?

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

use exists() instead of wait(), which does not throw exception FindFailed, but instead returns null.

Revision history for this message
bphand (bphand14) said :
#2

How long does exists() search for the image? As I said, I want to do something after Sikuli has spent some time searching for the image. I would like to give the computer some time to look for it, as I am using different machines with different speeds. But, I want the code to continue if the image fails to be found.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

Can you help with this problem?

Provide an answer of your own, or ask bphand for more information if necessary.

To post a message you must log in.