← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #178137]: How to use Wait statement ?

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
principally yes, but

-- you have to be sure it comes, otherwise, the script will hang FOREVER

-- if you want more control:

an example, that can be extended for full control on corrective actions
and retries:

max = 100
found = False
while max > 0:
    max -= 1
    if not exists(image, 0): wait(1); continue
    found = True; break
if found: click(getLastMatch())
else: print "not found"; exit(1)

This waits about 150 - 200 seconds (100 * (search time + 1 second)).

-- All other solutions use a specified waiting time and will have to
stop somehow:

if not exists(image, 200): print "not found"; exit(1)
click(getLastMatch())

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