Long press
long_pressSimulate a long press on any element or coordinates for a set duration, enabling context menus, item reordering, and other hold-based interactions in mobile UI tests.
Instructions
Long-press an element or coordinates for a duration (ms).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | Absolute x coordinate (alternative to a selector) | |
| y | No | Absolute y coordinate (alternative to a selector) | |
| id | No | Stable element id from inspect_screen | |
| ocr | No | Force OCR: locate `text` visually in the screenshot instead of the a11y tree (for off-tree / canvas / WebView elements). OCR is also used automatically when a text selector finds nothing in the tree. | |
| text | No | Match by visible text (case-insensitive substring) | |
| index | No | Pick the Nth match (0-based) when several match | |
| 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) | |
| duration_ms | No | ||
| resource_id | No | Match by resource-id (Android) / identifier (iOS) | |
| accessibility | No | Match by accessibility label / content-desc |