Find text (FR)
Perfecto Command
mobile:text:find
Purpose
Locates the test specified by the content parameter and stores its coordinates on the device for future use by other operations. Note that these coordinates are not sent back as return value.
This command is used as the first step in a Visual Relationship sequence:
- Perform Find text to identify the location of the string on the screen.
- Perform a text visual analysis command using the visual relation parameters to identify the element relative to the text identified with the Find text execution.
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. |
* Mandatory parameter
In addition, the General Visual Analysis common and text parameters are supported.
Return Value
String indicating success ("true") or failure ("false")
Exceptions
None
Examples
Copy
Java sample
Map<String, Object> params = new HashMap<>();
params.put("content", "sound");
params.put("context", "body");
String res = (String)driver.executeScript("mobile:text:find",params);
Copy
C# sample
Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("content", "recorder");
pars.Add("context", "body");
String result = (String)driver.ExecuteScript("mobile:text:find",pars);