iOS Simulator: Press Button
ios_simulator_press_buttonPress the home button on an iOS Simulator to background the app under test without terminating it. Optionally wait for animations and capture a screenshot to verify the result.
Instructions
Press a hardware button. home is the way back to the home screen and the reliable way to background the app under test without terminating it.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Which button. `home` works on Face ID devices too — it is the gesture, not the physical button. | |
| device | No | Which simulator: its UDID or its name as shown by ios_simulator_list. Omit it when exactly one is booted — that is the normal case, and IOS_SIMULATOR_ID pins it when it is not. Unlike simctl's own `booted`, this never picks arbitrarily between two. | |
| settle_ms | No | Milliseconds to wait before the follow-up screenshot, so an animation finishes first. Raise it for a screen that loads data; a capture taken mid-transition shows neither state. This is a pause for an animation, not a wait for work to finish — which is why it stops at ten seconds. For anything longer, use ios_simulator_wait_for_element. | |
| screenshot | No | Return a screenshot of the resulting screen. On by default, and worth leaving on: it is how you find out that the action landed where you meant it to. Turn it off only for a sequence whose intermediate states you do not need to see. |