Tap the screen
android_tapTap or long-press an Android screen at specified pixel coordinates. Use coordinates from android_dump_ui to interact with UI elements.
Instructions
Tap at a screen coordinate.
Get coordinates from android_dump_ui, which returns a ready-to-use centre point for every element. Coordinates are in device pixels and depend on the current rotation, so re-read the UI after rotating.
Args:
x (number): horizontal position in pixels
y (number): vertical position in pixels
serial (string, optional): target device
long_press (boolean): hold instead of tapping (default: false)
duration_ms (number): hold duration when long_press is set (default: 600)
Returns: { "tapped": [number, number], "longPress": boolean, "serial": string }
Examples:
Use when: android_dump_ui reported a button at (540, 1683) -> x=540, y=1683
Use when: opening a context menu -> long_press=true
Don't use when: you do not know where the element is (call android_dump_ui first)
Error Handling:
Coordinates outside the screen are silently ignored by Android; verify with android_dump_ui afterwards
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | Yes | Horizontal pixel coordinate. | |
| y | Yes | Vertical pixel coordinate. | |
| serial | No | Device serial from android_list_devices. Optional when exactly one device is connected; required when several are. | |
| long_press | No | Hold instead of a quick tap. | |
| duration_ms | No | Hold duration for a long press. |