Skip to content

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:

yaml
- pressKey: "keyToPress"

Supported keys ​

Use only one key at a time. Names are not case-sensitive.

KeyAndroidiOSDescription
homeYesYesPresses the home button.
enterYesYesPresses the enter (return) key.
backspace (or delete)YesYesDeletes the previous character.
tabYesYesPresses the tab key.
spaceYesYesPresses the space bar.
volume_upYesYesIncreases the device volume.
volume_downYesYesDecreases the device volume.
lockNoYesPresses the side button (locks or wakes the device).
siriNoYesHolds the side button to start Siri (real iPhone with iOS 27, through devicehid).
appSwitcherNoYesOpens the App Switcher (two Home presses; real iPhone with iOS 27, simulator).
actionButtonNoYesPresses the Action button (real iPhone with iOS 27, simulator).
screenshotNoYesTakes a screenshot into Photos (real iPhone with iOS 27).
backYesNoPresses the system back button.
powerYesNoPresses the power button.
menuYesNoPresses the menu key.
searchYesNoPresses the search key.
cameraYesNoPresses the camera key.
dpad_up, dpad_down, dpad_left, dpad_right, dpad_centerYesNoDirectional 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.