Legacy | Send key event

  • Command: key

  • Subcommand: event

  • 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, iOS

Sends a key event to the device, using key codes and metastates.

Description

Sends a keyboard event to the device. Uses standard Android keycodes. For example:

Key code = 29 and the Metastate = 1 will print an "A"

Key code = 29 and the Metastate = 0 will print an "a"

Key codes and metastates are defined by Android.

Parameters

Name Value Default Description
deviceID*     The device for this command.
key*     The key code key event to send to the device.
metastate     The metastate key event to send to the device.

* 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=keyboard&subcommand=display&param.deviceId=6370E775&param.mode=off
Copy

JSON response

{
    "reason":"Success",
    "timer.elapsed":"172",
    "returnValue":"OK",
    "testGridReportUrl":"https://mycloud.reporting-stg.perfectomobile.com?externalId[0]=john@perfectomobile.com_controller_16-11-08_13_44_00_1095",
    "description":"Success",
    "timer.system":"172",
    "completed":"true",
    "flowEndCode":"SUCCEEDED",
    "executionId":"john@perfectomobile.com_controller_16-11-08_13_44_00_1095",
    "timer.ux":"0",
    "singleTestReportUrl":"https://mycloud.perfectomobile.com/nexperience/singletest/report/?reportRepositoryKey=PRIVATE:controller/161108/controller_16-11-08_13_44_00_1095.xml&ownerId=john@perfectomobile.com&sharingCode=71a76172-e4d8-4d48-a224-7c618f7f1c37",
    "reportKey":"PRIVATE:controller/161108/controller_16-11-08_13_44_00_1095.xml",
    "timer.device":"0"}