Anyway to keep screenshots Sikuli take during running?

Asked by Edward Zhou

Is there anyway to keep screenshots Sikuli take during running?
As I understand, when Sikuli executes "click(aImage)", it will take a screenshot and then call openCV to find aImage in this screenshot. Is that possible I enable some setting to preserve the screenshot?

Add some context: on my app, if user clicks a button "go", a dialog will pop up with a "close" button. Today, I find out Sikuli clicks "go", the dialog does pop up after that but Sikuli doesn't click "close" . However, judging from Sikuli IDE's preview dialog, it can match the "close" button. In Sikuli's log, I can see at 1:03:05, it clicks "go" but in the same time it takes a screenshot, and then within following 3 seconds (as described in doc) it tries to find "close" in the screenshot but fails. My suspicion is that when it takes the screenshot, the dialog is not even there yet.

A side question: by default Sikuli does try to match a target (multiple times?) in 3 seconds but it seems it matches the target against the same screenshot (taken prior to that 3 seconds)?

Thanks in advance for answering and for providing such a great software!

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

--- seems it matches the target against the same screenshot
NO - it does not!
When using a search, that waits for an image (like with click(image) or wait(image)), during the given duration (standard 3 seconds) every new trial is started with a new screenshot (waiting would not make sense otherwise ;-)
How often the search during the waiting time should take place is controlled by the scanrate (standard 3 meaning 3 times per second). If a capture/search takes longer than 333 msecs (searching on whole, large screen), it may slow down to 1 - 2 trials per second.

So if your close button is visible on the screen during the search trials, the search region fits and the captured image is ok, then it should be found.

If not, then usually the image is bad or the waittime too short.

--- Is there anyway to keep screenshots Sikuli take during running?
Not a feature in your sense (to control the internal image search)

But to solve your problem, have a look here:
http://sikulix-2014.readthedocs.io/en/latest/region.html#exception-findfailed

e.g. using the prompt feature during development of a new script or for debugging.

Switching on debugging in a script using
Debug.on(3)

might give you also more information about what SikuliX is doing internally

Can you help with this problem?

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

To post a message you must log in.