Legacy | Press key

  • Command: presskey

  • Supported Platforms: Native (legacy), UFT (legacy), Selenium, Appium

    All commands must be executed using the same framework. Sharing the execution ID between different frameworks is not possible. This means that if you work with a Selenium/Appium driver, you need to call the commands using the Selenium/Appium driver (or, in the case of Reporting commands, through the Reporting SDK that works with the driver) and not as part of a UFT test or another framework.

  • Supported OS: Android

Description

Clicks a single key or a sequence of special device keys (either control or keyboard). You can hover over the device keys to identify them and then enter the Keys parameter according to the required syntax.

Common keys include: LEFT, RIGHT, UP, DOWN, ENTER, BACK, MENU, VOL_UP, VOL_DOWN, CAMERA, CLEAR

Important: The listed keys are not necessarily supported by all devices. The available keys depend on the device.

The Presskey command always presses 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

Parameters

Name

Value

Default

Description

deviceId*

   

The device for this command.

keySequence*

ENTER (ENTER)

MENU (MENU)

HOME (HOME)

BACK (BACK)

LEFT (LEFT)

RIGHT (RIGHT)

UP (UP)

DOWN (DOWN)

VOL_UP (VOL_UP)

VOL_DOWN (VOL_DOWN)

CAMERA (CAMERA)

CLEAR (CLEAR)

APP_SWITCH (APP_SWITCH)

 

The physical device keys to press. It is possible to select a sequence of comma separated keys.

To define a long key press, use a colon follow by the time in milliseconds.

Example: END:3000

To embed a wait as part of the sequence, use WAIT= followed by the time in milliseconds.

Example: WAIT=2000

For multiple key presses, use an asterisk.

Example: 3*ENTER

This is the same as: ENTER,ENTER,ENTER

Example: ENTER,WAIT=2000,2*DOWN,ENTER:3000

keypad

   

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.

* Mandatory parameter

Request & Response

Copy

Request

https://mycloud.perfectomobile.com/services/executions/john@perfectomobile.com_controller_16-11-08_13_44_00_1095?operation=command&securityToken=<your_token>&command=presskey&param.deviceId=6370E775&param.keySequence=UP