← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #300736]: FindFailed Error when image is not on screen

 

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

    Status: Open => Answered

Roman Podolyan proposed the following answer:
Learn Python try ... except .

https://docs.python.org/3/tutorial/errors.html#handling-exceptions

Here is how I handle it:

def try_click(our_image):       
    try:
        click(our_image)
        return True; 
    except FindFailed:
        return False 

If this code finds image, it clicks it and returns True. If  does not
find image, it just returns False, no Click executed.

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