Edit-text set (FR)
Perfecto Command
mobile:edit-text:set
Purpose
Identifies an edit field based on a text label and inserts the text specified in the value parameter into the field. The field is in relation to the found label and is defined by the label position and offset parameters.
Parameters
Name | Type | Possible Values | Description |
---|---|---|---|
label (Mandatory) | String |
|
The text that appears on, or related to, the edit field.
It is recommended to use the entire string searched for, to ensure that if the OCR misses a few characters, the label will still be found. |
text (Mandatory) |
String |
|
String - The text to insert in the edit field. Secured String - The encoded text to insert in the edit field. The text can be in any language. |
scope | String | sentence | contact | url | number | The text scope. Required for devices that support simulated text entry. Url Number - Dialing Sentence - Messages Contact - Phone book names Devices that support 'True-Text' do not require this parameter. |
caps | String | Aa | A | a |
The current capitalization state of typing. Only relevant if the current position is not the first character. Required for devices that support simulated text entry. Aa - automatically capitalize first character A - UPPERCASE lettering a - lowercase lettering |
In addition, the General Visual Analysis common and text parameters are supported.
Return Value
String containing either "true" or "false" indicating success or failure.
Exceptions
None
Examples
Java sample
Map<String, Object> params = new HashMap<>();
params.put("label", "my profile");
params.put("text", "Jon Smith");
params.put("label.direction", "below");
params.put("label.offset", "7%");
String res = (String) driver.executeScript("mobile:edit-text:set",params);
JavaScript sample
var params = {
"label":"String",
"text":"String",
"threshold":80,
"operation":"single" }
browser.executeScript('mobile:edit-text:set', params);
C# sample
Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("label", "my profile");
pars.Add("text", "Jon Smith");
pars.Add("label.direction", "below");
pars.Add("label.offset", "7%");
driver.ExecuteScript("mobile:edit-text:set",pars);