How to click a check box inside a region ?

Asked by srijith

I tried several syntax for this . dint workout!!!

it always give me error like " AttributeError: inside " or sometimes AttributeError: 'javainstance' object has no attribute 'region" please help.

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

the script would be helpful as you already know ;-)

the following works fine:

captured Subregion:
s = <captured region>
s = Subregion(0,0,500,500) # which would be a region [500x500] in the upper left of the screen
m = s.inside().find(<image>)

region defined by a match:
s = find(<pic>)
if s:
   m = s.inside().find(<image>)
else:
   popup("sorry, region not found!")

If you are working with the find alternative this way
find(<region pic>).inside().find(<inner pic>)
you miss the eventual not-found of <region-pic>, which leads to None.inside().find(<inner-pic>) and None does not know anything about .inside().

Revision history for this message
srijith (electronicmails1) said :
#2

s = <captured region>
s = Subregion(0,0,500,500)
click(s.inside().find(<image>))

I tried this , but it is clicking a check-box which is outside the specified region ( <captured region>)

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

Hi,

sorry for misleading (the second s= was only an additional example)

try this:
s = <captured region>
m = s.inside().find(<image>)
print m
click m

as long as I'm testing, I always work with variables to save intermediate results. the print gives you a good impression about what was really found with what similarity. e.g.
Match[19,127-66x83 1,00]@/var/folders/Cw/CwAqI2ylEqGdNCDuByhznU+++TI/-Tmp-/sikuli1777779916379257617.png
which means: found at x,y (upper left) - WidthxHeight 1,00 (similarity between 0 and 1)
the file after the @ contains the screenshot at the time of the find

If everything works fine you can compact your code if you want
click(<captured region>.inside().find(<image))

if you start with constructions like that, you may have a problem to find out what happened, if something does not work.

have a nice time.

Am 22.02.2010 um 12:28 schrieb srijith:

Question #101980 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/101980

   Status: Answered => Open

srijith is still having a problem:
s = <captured region>
s = Subregion(0,0,500,500)
click(s.inside().find(<image>))

I tried this , but it is clicking a check-box which is outside the specified region ( <captured region>)

--
You received this question notification because you are a direct
subscriber of the question.

Can you help with this problem?

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

To post a message you must log in.