← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #644808]: while exists (img, 0) always stop loop

 

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

    Status: Needs information => Answered

masuo proposed the following answer:
If image dose not exist when using click() and find() and wait(), FindFailed exception occurs.
http://sikulix-2014.readthedocs.io/en/latest/region.html?highlight=FindFailed

How to continue SikuliX process even if FindFailed exception will occur.

[sample codes]
while True:
    try:
        wait("1498310847322.png",0)
        print "Appeared"
        break
    except FindFailed:
        print "FindFailed"
        sleep(1)

A way to use exists() that dose not raise FindFailed exception.

[sample codes]
while True:
    if not exists("1498310847322.png",0):
        Do.popup("waiting",1)
    else:
        click()
        break

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.