Sikuli not able to distinguish between these 2 images

Asked by April L

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:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
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")

Revision history for this message
April L (april96) said :
#2

Thanks RaiMan, that solved my question.