wait(img, t) fails to identify an image

Asked by johan on 2017-08-01

I have defined a function as follows:

    def natsurClick(self, img, time=3):
            wait(img, time)

It awaits an image and then click at it. As it is now I have more than 50 tests were this method works and this 1 test were it fails about 4 out of 5 times for some reason.

20170801 FAIL :
FindFailed: FindFailed: training.png: (46x15) seen at (475, 425) with 1.00 in S(0)[0,0 1920x1200] E:Y, T:3.0
  Line 2759, in file Region.java

20170801 DEBUG :
Traceback (most recent call last):
  File "C:\..\tests\natsur.sikuli\natsur.py", line 432, in open_project_dialog
  File "C:\..\tests\natsur.sikuli\natsur.py", line 524, in natsurClick
    wait(img, 2)
  File "C:\.\sikulix.jar\Lib\sikuli\Sikuli.py", line 65, in wait
    return SCREEN.wait(target, timeout)

"training.png" is a 100% match and completely unique to the screen, the next match is found first around 25%.
The sequence to this point is correct every time, "training.png" is also visible every time, yet it fails to identify it.

Any suggestions of what could be the error here?

Question information

English Edit question
Sikuli Edit question
No assignee Edit question
Last query:
Last reply:
TestMechanic (ndinev) said : #1

Here are some suggestion

-- try to increase timeout
-- do not use 100% match

johan (rtjoh) said : #2

It is possible to solve the issue by handling the exception with setFindFailedResponse(SKIP), at the second try it has (so far) always found it. However, lowering the match to 70%, 50% or even 30% doesn't affect the outcome at all at the first try, still the exception is thrown.

As mentioned earlier, more than 50 different test cases are using this method, only this one case cause the error between 60 to 80% of the times among these. All images are done the same way and the match is shown as 100%, I just can't figure out why this is causing so much problems.

Can you help with this problem?

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

To post a message you must log in.