click_element
Invoke UI elements by name or automationId using UIA InvokePattern, with automatic window verification. No screen coordinates needed.
Instructions
Invoke a UI element by name or automationId via UIA InvokePattern — no screen coordinates needed. The server auto-guards using windowTitle (verifies identity, foreground, modal) and returns post.perception.status. Prefer over mouse_click for buttons, menu items, and links in native Windows apps. Use desktop_discover first to discover automationIds. Pass fixId from a suggestedFix to re-target after window identity drift. lensId is optional for advanced pinned-lens use. Caveats: Typed errors: code:'InvokePatternNotSupported' — the control does not expose InvokePattern, fall back to mouse_click; code:'ElementDisabled' — the element is in a disabled state, re-check preconditions before retry; code:'GuardFailed' — read the perception envelope (attention / guard fields) and choose recovery (re-focus, wait, or pass the suggestedFix.fixId on the next call). Some custom controls do not expose InvokePattern at all; fall back to mouse_click for those.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| windowTitle | Yes | Partial window title of the target window. Use '@active' for the current foreground window. | |
| hwnd | No | Direct window handle ID (takes precedence over windowTitle). String to avoid 64-bit precision issues. | |
| name | No | Element name/label (partial match, case-insensitive) | |
| automationId | No | Exact AutomationId of the element | |
| controlType | No | Control type filter, e.g. 'Button', 'MenuItem' | |
| narrate | No | Narration level. rich includes UIA or browser state diff when supported. | minimal |
| lensId | No | Optional perception lens ID. Guards (safe.keyboardTarget, target.identityStable) are evaluated before clicking, and a perception envelope is attached to post.perception on success. | |
| fixId | No | Approve a pending suggestedFix (one-shot, 15s TTL). | |
| include | No | Optional response-shape opt-in. `['envelope']` returns the self-documenting envelope (`_version` / `data` / `as_of` / `confidence`). `['raw']` forces raw shape (overrides DESKTOP_TOUCH_ENVELOPE=1 server default). Default behaviour is raw shape (compat with existing clients). |