tap_element
Taps a previously resolved mobile UI element by its elementId to trigger the intended interaction; verify the result with a separate expect_* check.
Instructions
Purpose: Tap a previously resolved UI element using its elementId.
Inputs:
elementId: a resolved UI element identifier returned by wait_for_ui
Output Structure:
action_id: unique timestamp-based action identifier
timestamp: ISO 8601 timestamp for the action attempt
action_type: "tap_element"
lifecycle_state: post-dispatch lifecycle state (pending_verification or failed)
source_module: runtime source of the action envelope
target.selector: original target handle ({ elementId })
target.resolved: minimal resolved element info used for the tap
success: true when the tap was dispatched
failure_code: present when success=false
retryable: present when failure_code exists
ui_fingerprint_before/ui_fingerprint_after: optional fingerprints captured around the action
Recommended Usage:
Resolve the target with wait_for_ui or another deterministic resolver
Call tap_element
If needed, wait for transition using wait_for_*
Verify outcome using expect_*
use expect_screen when navigation is expected
use expect_element_visible when the UI change is local
If verification fails, inspect failure_code and follow the retry strategy below
Verification Guidance:
Follow RESOLVE → ACT → WAIT (if needed) → EXPECT
Prefer expect_screen for navigation or modal transitions
Prefer expect_element_visible when the tap should reveal or update a specific element
wait_for_* may be used for resolution and synchronization, but not as the final verification step when an applicable expect_* tool exists
Do not treat tap_element.success as outcome success; it only means the tap was executed
Failure Handling:
STALE_REFERENCE → re-resolve the element, then retry
ELEMENT_NOT_INTERACTABLE → wait or refine the target, then retry
UNKNOWN → capture a snapshot and stop
This tool reports execution success only. Verification must be done with a separate expect_* tool.
Conditional input: optionally supply expectedState { snapshotSessionId, snapshotRevision, timeoutMs? } from a successful get_ui_tree on the same explicit platform/deviceId. A fresh normalized UI-tree check runs immediately before input, even with verification disabled. PRECONDITION_FAILED or PRECONDITION_UNAVAILABLE means no input was dispatched; inspect condition evidence and re-observe before deciding what to do next. Compact failures summarize the fresh condition evidence; use get_interaction_diagnostics with the returned diagnostics reference for the retained UI tree. This is not atomic with OS input delivery. Compact results summarize observations, condition trees, state deltas and readiness probe evidence within a byte budget. Use get_interaction_diagnostics with the returned diagnostics session_id/result_id to retrieve the original result without replaying input. Debug output is unchanged. Results include device_readiness with timestamped device blocker evidence. Android reports supported power/keyguard signals; iOS signals may be unknown or explicitly unsupported. Launch/input dispatch success does not establish app visibility or input readiness. No automatic unlock or wake is performed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| waitFor | No | ||
| deviceId | No | ||
| platform | No | ||
| selector | No | ||
| elementId | No | A unique element identifier returned by wait_for_ui | |
| responseMode | No | debug | |
| expectedState | No | ||
| actionTimeoutMs | No | Dispatch budget in milliseconds, clamped to 100–30000. | |
| verificationMode | No | full | |
| verificationTimeoutMs | No | Light observation budget in milliseconds, clamped to 100–60000. |