Image checkpoint (FR)

Perfecto Command

mobile:checkpoint:image

Purpose

Verifies that the given image appears on the device screen. In case of failure, the script will be marked as failed.

By default, the find image function searches for the image on the current screen. If there is a possibility that the selected image is not in the current screen, you can enable the Scroll and search parameter.

When enabled, the default scroll direction is down. For iOS devices, the default scroll direction is right. To change the scroll direction to down, select body as the Search area.

Parameters

Name Type Possible Values Description
content Multimedia

The image to search for.

The image can be taken from the device screen using the preview tool or selected from the media repository.

If selected from the repository the image must be a JPEG, PNG or BMP file.

x.alignment String none | left | center |
right
None (default) - Do not check for horizontal alignment
Left - Needle should be left aligned
Right - Needle should be right aligned
Center - Needle should be horizontally center aligned.
x.width String
Value specify the amount of allowed accuracy to still match the required alignment. (e.g. if 10% is used and the target is located at position 15 out of 320 than the validation succeed)
y.alignment String

none | top | center |

bottom

None (default) - Do not check for vertical alignment
Top - Needle should be top aligned
Bottom - Needle should be bottom aligned
Center - Needle should be vertically center aligned
y.height String
Value specify the amount of allowed accuracy to still match the required alignment (e.g. if 10% is used and the target is located at position 15 out of 320 than the validation succeed)

In addition, the General Visual Analysis common and image parameters are supported.

Return Value

String value - "true" or "false"

Exceptions

None

Examples

Copy

Java sample

Map<String, Object> params = new HashMap<>();
params.put("content", "PRIVATE:/images/Home-cropped.png");
params.put("threshold", 80);
String res = (String)driver.executeScript("mobile:checkpoint:image", params);

if (res.equalsIgnoreCase("true")) {
    //successful checkpoint code
} else {
    // failed checkpoint code
}
Copy

C# sample

Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("content", "PRIVATE:/images/Home-cropped.png");
pars.Add("threshold", 80);
driver.ExecuteScript("mobile:checkpoint:image", pars);