How can i match my Screen Shot in exact way?

Asked by Krishna

Hi,

 I am having a checkbox with some label. I have taken whole screen shot of check box with label. I need to check whether the check box is checked or not, So i am trying to ensure image exists or not by checking Match object null. But for both check box check and Uncheck i am getting same result and hence my else is not executing. Please give a solution to check the exact image exists or not.

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

You have to specify a matching score, to differentiate:

btnChecked = Pattern("image-button-checked").similar(0.99)

(more information: see docs)

if exists(btnChecked):
    print "checked"
else:
    print "unchecked"

You can check/set your similar setting in the Preview window or use
print find("some-image.png")

to find out the matching score.

Revision history for this message
Krishna (krishnamurthy-k) said :
#2

I think the solution in java is little bit different. Can you pls guide me in java?

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

Might be that it is different, but you should be able to translate it from Python to Java based on Sikuli's Java docs - rather simple ;-)

Pattern btnChecked = new Pattern("image-button-checked")
btnChecked = btnChecked.similar(0.99)

Can you help with this problem?

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

To post a message you must log in.