← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #161233]: How to resolve intermittent FindFailed errors with .png files

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
Possible reason 1:
When you click on something, it takes some time until the target application has changed the screen content so your next find operation finds on the screen, what you expect. These times may vary, since there is always something in the background, that consumes resources, even if Sikuli and your target application are "alone" on the machine. This gets even worse, when your target app is a web app running in a browser and is dependent on something that has to be loaded from the web.
conclusion: the standard waiting time of 3 seconds for the visual object to appear on the screen might be too short in some cases.

Possible reason 2:
In some applications the background of an element you want to search is different over the time. So if too much of this changing background is captured together with what you really want, the score of the find operation might stay below the standard minimum similarity of 0.7.

In both cases, the standard reaction of Sikuli script is to abort the script with the exception FindFailed.
(read more: http://sikuli.org/docx/region.html#exception-findfailed)

--- To avoid timing problems, you might increase the waiting time: 
read more http://sikuli.org/docx/region.html#Region.setAutoWaitTimeout
e.g. set it to 10 seconds and the timing problems might vanish.

--- for reason 2, it helps to restrict the capture, so as little as
possible is captured of the background.

More good practices to make scripts robust:
--- use wait/exists for individual waiting and click(getLastMatch()) to click the found match
--- restrict the find operations to the region, where it should be found (application window, columns/boxes on a web page, ...)
--- find one key element and click on others using calculated offsets instead of additional find operations

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