Text checkpoint (FR)

Perfecto Command

mobile:checkpoint:text

Purpose

Verifies the text specified by the content parameter appears on the device screen.

By default the text is searched on the current screen. If there is a possibility that the text is on a following 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 in the Search area parameter.

Parameters

Name Type Possible Values Description
content String

The text to search for.

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)
match String contain | equal | startwith | endwith | first | last | index The text comparison method.
Contain - text is part of the haystack
Equal - text is equal to the haystack
Start with - haystack text begins with the text
End with - haystack ends with the text
First - first occurrence of the text
Last - last occurrence of the text
Index - defined occurrence of the text, used together with the Index parameter

In addition, the General Visual Analysis common and text 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", "Perfecto Mobile");
params.put("threshold", 80);
String res = (String)driver.executeScript("mobile:checkpoint:text", 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", "Perfecto Mobile");
pars.Add("threshold", 80);
driver.ExecuteScript("mobile:checkpoint:text", pars);
Copy

TypeScript sample

function checkpoint(content: String, timeout: String) {
    browser.execute('mobile:checkpoint:text', {
        "content": content,
        "measurement": "accurate",
        "source": "camera",
        "analysis": "automatic",
        "index": "1",
        "threshold": "90",
        "timeout": timeout
    });
}