← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #239630]: Handle events that might/not occur during a test case

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Yes, there is an observe option, that might run in background, catch these events and handle them.
http://doc.sikuli.org/region.html#observing-visual-events-in-a-region
Come back if you want to use it with 1.0.1, since it has changed a little.

The challenge: currently, there is no synch between main workflow and event handler with respect to mouse and keyboard.
So if you have to use the mouse in the handler, your main workflow might be disturbed.
And your main workflow might crash anyway, because the popup produces a find failed.
So it is not just having this handler, but also some special coding in your main workflow.

depending on your scripting/programming knowledge: you might delegate
the observation implemented with normal Sikuli exists() loops to
threads, that would allow some better control with locking.

I have this on the list for some improvements in Sikuli for next year in version 1.2 ;-)
a possible solution: tell a Pattern, that there are some prereqs to be full filled for a successful find, so it might be possible, to handle such disturbing popups in the FindFailed section and repeat the find automatically.

You might already do that on your own currently:
wrap the Sikuli find in a function the handles this.

and instead of using:
click(image)

you would use:
click(myFind(image))

The myFind surely will have some more parameters, to control what is
done inside.

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.