button
Press hardware buttons like home, back, or power on iOS simulators or Android devices, sending the correct key event to the target platform for UI testing and automation.
Instructions
Press a device hardware button (iOS simulator or physical device, Android emulator or device). iOS simulators send a Down then Up event automatically; Android injects a single adb key event.
Supported buttons depend on the platform: home, back, power, volumeUp, volumeDown, appSwitch, actionButton; buttons not present on the target platform (e.g. 'back' on iOS, 'actionButton' on Android, 'power' or 'appSwitch' on a physical iPhone) are rejected with a clear error.
Use when you need to trigger hardware button events.
Returns { pressed: buttonName }.
Fails if the device backend is not reachable: the simulator-server for iOS, or adb for Android (Android presses are injected with adb shell input keyevent).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| udid | Yes | Target device id from `list-devices` (iOS UDID or Android serial). | |
| button | Yes | Hardware button to press |