Find and tap element
adb_find_and_tapFind an on-screen element by text, resource-id or content-desc and activate it over ADB, tapping touchscreens or walking DPAD focus on leanback devices.
Instructions
Find an on-screen element by text, resource-id or content-desc and activate it. The method is derived from the device: with a touchscreen the element centre is tapped; on leanback without one the focus is walked there with DPAD keys, since a coordinate tap activates whatever has focus. If the focus stalls, cycles, or the target is not reached in max_steps or the time budget, nothing is pressed and the tool reports where it stopped. Prefer it over adb_ui_dump plus adb_tap when the label is known; use adb_tap for a point that has no label.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| desc | No | content-desc to match | |
| text | No | Visible label to match, checked against both the text attribute and content-desc (substring by default, case-insensitive). Some TV launchers put every label in content-desc and leave text empty. | |
| exact | No | Require an exact match instead of substring. Default false. | |
| index | No | Which match to use when several elements match. Without it, several matches are an error listing the candidates. | |
| serial | No | Device serial from adb_devices. Optional when exactly one device is connected. | |
| max_steps | No | Max DPAD steps on leanback devices, default 12, max 40. Each step re-dumps the UI (~1.5-2s) and the walk also stops after an internal ~25s budget, returning a report instead of timing out. | |
| resource_id | No | resource-id; the part after "/" is enough |