Press key
press_keyPress hardware/system keys like back, home, or enter on Android and iOS devices to trigger system actions during UI testing.
Instructions
Press a hardware/system key. Android: back, home, enter, tab, delete, search, menu, volume_up, volume_down, app_switch, power. iOS: enter, delete, tab, space, escape, home, lock, siri.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"device_id": "<device_id>",
"key": "<key>"
},
"name": "press_key"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Key name (e.g. 'back', 'enter', 'home') | |
| observe | No | What to return after the action: 'screen' = fresh compact hierarchy, 'diff' = only what changed since last inspect, 'screenshot' = PNG, 'none' = just confirm. | screen |
| device_id | Yes | Device id from list_devices (adb serial like 'emulator-5554', or an iOS simulator UDID) |