pressKey
Press hardware keys like home, back, enter, or volume buttons.
Partial support in Astra Scout
Only the keys listed in the table below are available, and the list differs per platform. Android TV remote keys (Remote Dpad Up, TV Input, and similar) are not supported. lock works on iOS only. Key names are not case-sensitive and accept Maestro's spellings: volume_up, volume up and Volume-Up are the same key, and a leading Remote is ignored (Remote Dpad Up is dpad_up). Media keys (Remote Media …), TV Input and the other TV remote keys are not available on any platform.
The pressKey command simulates pressing a physical or virtual key on a device.
Syntax
To use the pressKey command, you need to define the key to be used:
- pressKey: "keyToPress"Supported keys
Use only one key at a time. Names are not case-sensitive.
| Key | Android | iOS | Description |
|---|---|---|---|
home | Yes | Yes | Presses the home button. |
enter | Yes | Yes | Presses the enter (return) key. |
backspace (or delete) | Yes | Yes | Deletes the previous character. |
tab | Yes | Yes | Presses the tab key. |
space | Yes | Yes | Presses the space bar. |
volume_up | Yes | Yes | Increases the device volume. |
volume_down | Yes | Yes | Decreases the device volume. |
lock | No | Yes | Presses the side button (locks or wakes the device). |
siri | No | Yes | Holds the side button to start Siri (real iPhone with iOS 27, through devicehid). |
appSwitcher | No | Yes | Opens the App Switcher (two Home presses; real iPhone with iOS 27, simulator). |
actionButton | No | Yes | Presses the Action button (real iPhone with iOS 27, simulator). |
screenshot | No | Yes | Takes a screenshot into Photos (real iPhone with iOS 27). |
back | Yes | No | Presses the system back button. |
power | Yes | No | Presses the power button. |
menu | Yes | No | Presses the menu key. |
search | Yes | No | Presses the search key. |
camera | Yes | No | Presses the camera key. |
dpad_up, dpad_down, dpad_left, dpad_right, dpad_center | Yes | No | Directional pad keys. |
iOS hardware keys
lock works without the device mirror (through the WebDriverAgent of the running flow; on a simulator, if that fails, open the simulator in Astra Scout). siri, appSwitcher, actionButton and screenshot need the device open in Astra Scout (the mirror); otherwise the step fails and says so.
