How to stop my script when ever a target appears

Asked by Frank Chi

I am trying to test an installation process. Basically my code runs through the whole installation process. What i want is that when ever an error message pops out , i want to stop the whole process and take a screen shot of that error page. But since i will need to do that for every single step, i don't know how i can do that. Seems like i will have to put an if statement after every page shift, which is a bit too much. Is there any simple way?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Eugene S
Solved:
Last query:
Last reply:
Revision history for this message
Best Eugene S (shragovich) said :
#1

Hi,

Take a look at the Observe:
http://doc.sikuli.org/region.html#observingvisualeventsinaregion

As it appears in the documentation:
You can tell a region to observe that something appears or vanishes, or something changes in that region. It is possible to let the script wait for the completion of an observation or let it run in the background, while your script is continuing.

Looks like what you're looking for.

Eugene S

Revision history for this message
Frank Chi (frank-chi) said :
#2

Thanks Eugene S, that solved my question.