setFindFailedResponse(PROMPT) with exists(): abort does not work (same as skip)

Asked by masuo

Even if image.png is not on a screen, exists(image.png) do not raise a FaidFailed exception.
Is this behavior correct?

Question information

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

exists() by design does not raise the FF-exception, but catches it internally.

In case of not found it returns Java-null (Python-None, which is False) and the match, if successful.

so setFindFailedResponse(PROMPT) should only affect the behavior of search features, that raise FF-exception (find, wait, ...)

Revision history for this message
masuo (masuo-ohara) said :
#2

Sorry, I did not explain this question in detail.
When I want to wait until image will appear, I use the following code.

While not exists(image.png):
    wait(1)

Now setFindFailedResponse(PROMPT) affects exists() too.
I want to wait until the image will appear, but SikuliX display prompt.

Revision history for this message
masuo (masuo-ohara) said :
#3

When prompt-window open by exists("image.png"), Abort button dose not work.
When I click Abort button on prompt-window, SikuliX do not abort.
SikuliX behaves as if I click Retry button.

Revision history for this message
Karl (k-d) said :
#4

The "retry" behavior is because of your while loop, not sikuli.

To abort your script use exit(1) or Alt-Shift-C.

Revision history for this message
masuo (masuo-ohara) said :
#5

Karl, thank you for response.
When using find, SikuliX abort.

setFindFailedResponse(PROMPT)
while True:
    find("1456263601570.png")
    wait(1)

So I think that we should not use exists() and setFindFailedResponse(PROMPT) together.

Revision history for this message
Launchpad Janitor (janitor) said :
#6

This question was expired because it remained in the 'Open' state without activity for the last 15 days.