Select text (FR)

Perfecto Command

mobile:text:select

Purpose

Clicks on the text specified by the label parameter.

By default, the select text function searches for the text on the current screen. However, if there is a possibility that the selected text is not on the current screen, 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.
It is recommended to use the entire string searched for, to ensure that if the OCR misses a few characters, the needle will still be found.
The text-match algorithm is less error-prone when the provided string is longer.
context String all | body Defines the screen region where to look for the needle.
shift String none | above |
below | left | right |
leftmost | rightmost
The direction to move the touch location, relative to the center of the found needle.
To use, select the direction and the Position value distance.
By default, the touch operation position is at the center of the matched needle.
For Leftmost and Rightmost, the value represents the distance from the screen edge.
None
Above
Below
Left
Right
Leftmost
Rightmost
offset String

The distance from the center of the found needle to the location of the touch operation. Used alongside the Touch position parameter.

Value is interpreted to be either

  • a number of pixels
  • or a percentage of screen width (0-100). For percentage use the % sign. Example - 20%
operation String single | double |
long | roll | none
The touch operation to perform on the found image location.

* Mandatory parameter

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

Return Value

None

Exceptions

Runtime exception if the text is not found on the screen.

Examples

Copy

Java sample

Map<String, Object> params = new HashMap<>();
params.put("content", "Actions");
params.put("threshold", 80);
driver.executeScript("mobile:text:select", params);
Copy

C# sample

Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("content", "ToDo");
pars.Add("threshold", 80);
driver.ExecuteScript("mobile:text:select", pars);