find to different images then if found execute different action

Asked by ed hyip

I tried looking around but didn't really see what I am looking for. What I want is after entering a website, search for imageA or imageB, if imageA is found, refresh again. If imageB is found, then proceed to other command. Then loop again.

what I have now is something like this
entering a url
while exists (wait("imageA",FOREVER) or wait("imageB",FOREVER)):
   if exists("imageA"):
                click("refresh")
            else:
                click(imageC)
loop

thanks in advance :)

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Eugene S
Solved:
Last query:
Last reply:
Revision history for this message
Best Eugene S (shragovich) said :
#1

Hi,

You can try something like that:

while True:
    if exists("imageA.png"):
        print "image A found. going to refresh"
        click("refresh.png")
    elif exists("imageB.png"):
        print "image B found!"
        click("imageC.png")
        break
    else:
        pass

Cheers,
Eugene S

Revision history for this message
ed hyip (edhyip92) said :
#2

Thanks Eugene S, that solved my question.