Script not finding images sometimes

I have a script that I have been trying to run without error many times. I have not made it through the whole script yet. Sometimes it will error on an image during one run of the script, but then it will find it on another run of the script. I am wondering if I need to add some refreshscreen commands to my script. I am not sure why it would find the images sometimes and not others. It is always in view for me, but the script will not see it.
Any suggestions would help. Thanks!

Often this is just an issue of timing – if your system-under-test or your network is a little bit slow, things may be getting back to the Eggplant machine just before it would give up 90% of the time, and after it has given up 10% of the time.

If it looks like the image is there, there is a simple test to determine whether it wasn’t found because of timing or because it really is different from your test image:

When the script fails, before you do anything else, identify the line that it failed on and select it (it should already be selected). Now click the “Run Selection” toolbar item on the Script Editor window. If Eggplant finds the image when you do the run selection, then it is likely that the problem is one of timing; if it still doesn’t find the image, then something about that image is different than when it was captured.

You can correct for timing issues by a) adding a WaitFor before the step that is failing or b) adjusting the overall timing of Eggplant. If the problem is relatively consistent and in just a couple of places, a WaitFor will probably work. But if the problem is random and occurs frequently, then you probably want to slow down all of Eggplant’s interactions with the system-under-test. This is best accomplished by opening the Eggplant Preferences panel and under Run Options > System increasing the Remote Work Interval setting slightly, and/or under Run Options > Screen, increasing the Image Search Time a bit. Increasing the Remote Work Interval will slow everything down – it is the amount of time that Eggplant waits between sending events to the remote system. Increasing the Image Search Time has less of an effect on overall script execution times because it just gives Eggplant more time to look for an image when it needs more time – if the image is found quickly, Eggplant just moves on, just as happens with the WaitFor command.

I encountered a similar problem and have applied your suggestions but still it occurs intermittently. It cannot find the image sometimes and when I investigated it the image wasn?t really there. I also noticed that probably the reason why it couldn?t find the image is because the previous DoubleClick instruction did not really double clicked the image. My hunch is it just clicked it because the image is already highlighted. I have already set the MouseDoubleClickDelay to .00001 and RemoteWorkInterval to 2.0. Do you have any other suggestions?

You should be making the DoubleClickDelay longer, not shorter. The DoubleClickDelay setting is the amount of time between the end of the first click and the start of the second click – on slower machines you sometimes have to be a bit deliberate when doing a double-click. Since the default value for the DoubleClickDelay is 0.01, you might want to start with 0.05 and if that doesn’t work, try bumping it up to 0.1. The setting you are currently using (.00001) isn’t really meaningful, because it is probably quicker than the system is even capable of performing the double click, so it’s basically just double-clicking as fast as it can.

You should also set the RemoteWorkInterval back to 0.7 – by increasing it to 2.0, you’ve increased the time between all of the steps in your script (slowing the script down a lot), but that won’t affect the timing of the events that make up a double-click.

Let us know if you are still having problems after you try again with these settings.