Tips and Tricks

This chapter contains a few solution suggestions of how to handle some common situations.

Working with Images

Images are small screen captures. The target location or area is in the center of the small screen capture by default.

Use the Properties dialog to change the target location on a Move command (like Move or Click). You may also change the target location into a target area. Use the mouse to click and drag in order to select a target area of the image. A target area is more specific than a target location and can be used to make the script more reliable in some situations. Both the target area and the surrounding area needs to be verified in order to accept the location. Note that selecting a too large or improper target area might have a negative impact to the image detection.

Use the Properties dialog to change the area to check in a Check command. Use the mouse to click and drag in order to select the target area to check. Both the area to check and the surrounding area needs to be verified in order to accept the match. It is, in other words, not enough that the area to check can be found on screen. A target area is automatically selected if no area to check is specified.

Use the Properties dialog to change the selected area on a Capture, Read or Region command. The entire image is used by default but the blue selection rectangle can be used to, for example, only capture a smaller area of the image.

The ConfirmationLevel can be adjusted to make the comparison less or more tolerant to deviations between the image and the appearance on screen. Increase the value if EyeAutomate finds an incorrect image or reduce the value if an image cannot be found.

Pausing the Script

A human often waits for something to appear on screen before continuing. There are several different ways to delay the script.

The simplest , but also the most unreliable, is to wait a fixed number of milliseconds. A large number slows down the script while a too low value might not be long enough.

Use the Wait command, with no parameters, to delay the script until something, like a new page or dialog, appears on screen. It will also wait until the screen has become stable again. Wait ignores small changes (less than 1000 pixels). This is a quick fix but might be unreliable in some situations.

The most reliable delay is to wait for an image to appear on screen. It is also possible to provide more than one image to the Wait command. The command will continue when either of the images appears.

Recover from a Failed Command

How to handle a situation when a command might fail for some reason. The script would become a lot less fragile if you could provide one or several ways to handle a problem when running the script.

There are several ways of recovering from an error in EyeAutomate. One way is to let the tester handle the failed step manually. Use the Begin and End commands for this. Place the Begin command before the first line to be able to recover from and place the End command after the last line to recover from. The Begin/End block will in this case represent one operation that can be performed both automatic and manual.

An example of a Begin/End block:

Use the Catch command inside a Begin/End block to try to recover automatically. The step will still be handled manually if the Catch/End block fails.

The example below will start Google Chrome from the Start menu if not already visible:

You may use any number of Catch commands inside a Begin/End block.

Remember that it is possible to insert images into the manual instruction. An image may make it easier for the tester to follow the manual instruction.

Capture Images

Images are important in EyeAutomate. Here are some tips on what to think about to get the best script run result.

  • Try to click directly on something unique when recording. To click on some text or image is a good choice. Do not click on a blank spot, for example next (left or right) to a text in a list.
  • Recapture an image if you experience run problems.
  • Larger images are more reliable but slower to recognize.
  • Record the script slowly. Recording too fast might result in problems with the captured images.

Multiple Sets of Images

The ImageFolder is a built-in parameter designed for making it really easy to develop scripts that uses different sets of images. This makes it possible to run the same script on, for example, various operating systems or in different screen resolutions.

Change image folder used by EyeStudio using the Set image folder option in the Settings menu. Recapture all images when using the other operating system or screen resolution. Create a test suite and call the same script twice but with a different file-path in the ImageFolder parameter, like in the example below:

Call "ImageFolder=images" "scripts/calc1.txt"
Call "ImageFolder=images2" "scripts/calc1.txt"