Sikuli not able to distinguish between these 2 images

Asked by April L on 2018-05-18

I want sikuli to click on OK if it looks like https://pasteboard.co/HlIH9xP.png and print "Error" if it looks like https://pasteboard.co/HlIHtFh.png. Sikuli is not able to differentiate between the 2 images. What should I do?

//code
if exists("OK_Correct.png"):
    click("OK_Correct.png")
else:
     print("Error")

It is trying to click on the image even when the 2nd image is there.

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2018-05-18
Last query:
2018-05-18
Last reply:
2018-05-18
Best RaiMan (raimund-hocke) said : #1

this should work:

if exists(Pattern("OK_Correct.png").similar(0.99)):
    click(getLastMatch()) # or simply click() with version 1.1.2+
else:
     print("Error")

April L (april96) said : #2

Thanks RaiMan, that solved my question.