← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #244181]: My scripts are failing due to slight change in radio button. How to overcome this issue?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
simply no ;-) (if I understood right ;-)

If you want to position based on the button labels, then these images should only contain the label.
If you want to check the status of the corresponding radio button, you have to look for it in the area right of the label with an adequate image/pattern (as mentioned above).

Generally it is always a good idea to look for images only in a
(evaluated/calculated relative to some know region/match) region as
soon/often as possible.

radioBtnArea = <some evaluated region>
lbl1 = radioBtnArea.find(labelImage1)
selected = False
btn1Area = lbl1.right(100) 
if btn1Area.exists(radioBtnSelected, 0): # for example ;-)
    selected = True
# do what is needed
if selected:
    btn1Area.click() # would click the button to unselect it 

you might do all this with calculated offsets too

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.