tags:

views:

33

answers:

1
switchApp("Safari.app")
t = find(img) 
t1= capture(t.getX(), t.getY() - 25, t.getW(), t.getH(),)
click(t1)
sleep(1)
type("text")
sleep(2)
type(Key.ENTER)
type(Key.PAGE_DOWN)

I have the above working once.. however, how would i repeat this to do the same for all matches on a web page? I'm not sure the code for looping this action / repeating.

Thanks

A: 

See example usage of the findAll function here: http://sikuli.org/trac/wiki/reference-0.10#IteratingMatches

You might do it like this:

with findAll(img) as tt:
    while tt.hasNext():
        t = tt.next()
        t1 = capture(t.getX(), t.getY() - 25, t.getW(), t.getH())
        # etc.
Roy Tinker