sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #02893
Re: [Question #158009]: Sikuli can't distinguish checked and unchecked box.
Question #158009 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/158009
Status: Open => Answered
RaiMan proposed the following answer:
This might well be, depending on the images you have taken from the
checkboxes in the two states (checked/unchecked).
The search algorithm says found, if the match has a score of at least
0.7. This seems to be in both cases, but they have different scores.
I would suggest, to only look for the checked version, e.g.
with Region(r):
if exists("checked.png"): popup("checked")
else: popup("unchecked")
next I would make a simple test:
print Region(r).find("checked.png")
Region(r).getLastMatch(highlight(3)
this should print something like:
Match[244,151 67x64] score=1,00, target=center
and highlight the checkbox for 3 seconds with a red frame
I guess in your case, the score should be 1.0 if you are looking with
"checked.png" for a checked box.
So even without having tested your situation, I guess this will work in
all cases (supposing in Region(r) there always is only one checkbox):
with Region(r):
if exists(Pattern("checked.png").similar(0.9)): popup("checked")
else: popup("unchecked")
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.