Press a key or chord
electron_keyPress a key or chord (e.g., 'Enter', 'Control+A') on an element specified by CSS selector or accessibility ref, with optional force to bypass actionability checks.
Instructions
Press a key or chord (e.g. 'Enter', 'Control+A', 'ArrowDown'). Focuses ref/selector first when given; otherwise presses against the active element. For editors, click the visible content area first; reserve force:true for offscreen inputs that truly accept focus. Options: force, timeoutMs. Returns: { ok, session_id, key }. Errors: SELECTOR_NO_MATCH / REF_NOT_FOUND (carries similar_refs), ELEMENT_NOT_VISIBLE (retryable), NOT_RUNNING, BAD_ARGUMENT (ref+selector both).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Key or chord, e.g. 'Enter' or 'Control+A'. | |
| ref | No | Element ref from a snapshot (resolves to [data-sw-ref="N"]). Provide ref OR selector. | |
| force | No | Bypass actionability checks (visibility/enabled/stable). Default false. | |
| selector | No | CSS selector. Provide ref OR selector, not both. | |
| sessionId | No | Target session id. Omit when a single session is running. | |
| timeoutMs | No | Actionability budget in ms (default 5000, clamped to 30000). |