← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #235451]: multiple selection

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
the flexible part of the code (specific for the list):

top = find(Pattern(Pattern("some_pic.png").targetOffset(0,18)))

the fixed part of code (valid for each list)

topP = top.getTarget()
lineNbr = random.randint(0, 30)
click(topP.below(lineNbr * lineH))

so we put the fixed stuff in a def():

def clickList(top):
    topP = top.getTarget()
    lineNbr = random.randint(0, 30)
    click(topP.below(lineNbr * lineH))

and use it this way:

top1 = find(Pattern("some_pic.png").targetOffset(0,18)) # ref for list 1
clickList(top1)

top2 = find(Pattern("some_other_pic.png").targetOffset(0,18)))# ref for list 2, may be different targetOffset
clickList(top2)

... I guess you got it ;-)

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