device_tap_by_text
Find a UI element by text, content-description, or resource-id and tap it. NOT always usable — for elements without stable text/contentDesc/resourceId (image-only icons, custom Canvas widgets, dynamic/localized labels), use device_tap(x, y) with bounds from device_page_source instead. Both tools are first-class. When multiple nodes share the same text, this tool ranks candidates so an interactive widget (EditText, Button) wins over a passive label (TextView) — pass resourceId to pin a specific element. Returns after the tap is dispatched; an additional ~150ms focus-settle wait is included when the matched element is an EditText so a following device_type lands in the right field. CRITICAL: call this BEFORE device_type sequentially — do NOT issue both in parallel, or the type may race the focus change and write into the previously-focused field.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | Visible text of the element (matches text or content-desc) | |
| udid | Yes | Device serial number (UDID) | |
| maxScroll | No | Max auto-scroll attempts before giving up (default: 3) | |
| autoScroll | No | If not found on-screen, scroll to look for it before failing (default: true) | |
| resourceId | No | Resource ID (e.g. com.android.chrome:id/url_bar) | |
| contentDesc | No | Content description / accessibility label | |
| scrollDirection | No | Auto-scroll direction (default: down) |