tap_element
Taps Android UI elements by index, text, resource ID, description, or coordinates; supports long press and returns confirmation and timing.
Instructions
智能语义点击工具。支持按 #index、text、text_contains、resource_id、description 或 (x, y) 点击。
点击即返回确认与耗时,不默认回抓整棵树——观察交给 ui_snapshot 的差异模式,节奏才跟得上手。
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | 兜底直接点击的横坐标 X | |
| y | No | 兜底直接点击的纵坐标 Y | |
| text | No | 精确匹配元素文本(如 '设置'、'确定') | |
| index | No | 来自 get_ui_tree 或标注截图的元素编号(如 0, 1, 2) | |
| long_click | No | 是否长按,默认 False | |
| description | No | 匹配元素的 content-desc 无障碍描述 | |
| resource_id | No | 匹配元素的 resource-id 或短 id(如 'search_box' 或 'com.xxx:id/btn') | |
| wait_timeout | No | 若按文本/ID查找,最多等待元素出现的秒数,默认 3.0 秒 | |
| text_contains | No | 模糊包含匹配元素文本 | |
| wait_after_ms | No | 点击后等待界面响应的毫秒数,默认 0ms;需要等待请用条件 | |
| return_ui_after | No | 点击后是否附带完整新界面 UI 树。默认 False——这次重抓是全流程里最贵的一步(全树约 200ms + 大量上下文);连续点击时保持 False,需要看变化用 ui_snapshot(since_snapshot_id=...) 只取差异 |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |