Press key (FR)
Perfecto Command
mobile:presskey
Purpose
Clicks on a single or sequence of special device keys (either control or keyboard). You can hover over the device keys to identify them, then enter the Keys parameter according to the required syntax.
Common keys include: LEFT, RIGHT, UP, DOWN, OK, BACK, MENU, VOL_UP, VOL_DOWN, CAMERA, CLEAR
Presskey will always press the keyboard keys according to the default layout configuration.
To press on Enter/Submit/Search, as the Keys parameter value, enter the following (supported on Android and iOS):
- KEYBOARD_GO
- KEYBOARD_SEARCH
- KEYBOARD_SEND
- KEYBOARD_NEXT
- KEYBOARD_DONE
- KEYBOARD_PREVIOUS
- KEYBOARD_ENTER
- KEYBOARD_SUBMIT
To activate Siri on devices running 10.3 or later and configured for the XCUITest Framework, use the value LONGHOME.
Parameters
Name | Type | Possible Values | Description |
---|---|---|---|
keySequence | String |
OK | |
(Required) The physical device keys to press. It is possible to select a sequence of comma separated keys. Note: For iOS, the only supported values are HOME and LONGHOME. |
keypad | String |
|
Specify the logical name of the virtual keypad to be used. A virtual keypad is defined as the keypad popping up to the user when inputs are required.
This parameter is operational only on selected touch-enabled platforms. |
Return Value
None
Exceptions
None
Examples
Java sample
Map<String, Object> params = new HashMap<>();
params.put("keySequence", "BACK");
driver.executeScript("mobile:presskey", params);
JavaScript sample
var params = {
"keySequence":"OK" }
browser.executeScript('mobile:presskey', params);
To activate Siri
Map<String, Object> params = new HashMap<>();
params.put("keySequence", "LONGHOME");
driver.executeScript("mobile:presskey", params);
C# sample
Dictionary<String, Object> pars = new Dictionary<String, Object>();
pars.Add("keySequence", "BACK");
driver.ExecuteScript("mobile:presskey", pars);