Handle events that might/not occur during a test case

Asked by Sarav

Hi,

I have been recently looking out for options - where some events might / might not be part of my test-case.

Is there a graceful way to handle (to close it / do some operation) a event - say a known popup(by image) / known window(by image) that might block[if occupies the current screen foreground] the current test case that is running, and proceed without restarting the whole testcase.

How do i still listen for such events - immediately and handle that - while resuming the actions - left-out on running test-case.

I cannot use while -loop because it would be (sequential.) loop - but my event cases might be at any moment during the testcase.

(seque[event1]ntial.)
(s[event1]equential.)
(sequential[event1].)

I see there is an observe option - could you please throw some light on this?

Thanks

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

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.

Can you help with this problem?

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

To post a message you must log in.