Skip to content

Add 'key' command — dispatch CDP keyboard events (Enter, Tab, Escape, …) to the focused element #40

@apireno

Description

@apireno

Motivation

Modern SPAs (LinkedIn, …) bind activation handlers to Enter on a focused tabindex element, not to a click on an outer wrapper. Issue #37 surfaced this for LinkedIn's conversation list: the wrapper `

  • ` accepts a trusted click but the React handler is on the inner `
    ` and listens for Enter. The AX tree literally labels the inner element `press_return_to_go_to_conversation_detail`.

    Currently the only way to dispatch a keypress is via `js` with a synthesized `KeyboardEvent` — heavyweight, write-tier, and the event isn't trusted at the browser level.

    Proposed

    ```
    key [--text ] [--modifiers ctrl,shift,alt,meta]
    ```

    Dispatches via CDP `Input.dispatchKeyEvent` — produces trusted key events React respects.

    Examples:
    ```
    key Enter
    key Escape
    key Tab
    key F5
    key a --modifiers ctrl,shift # Ctrl+Shift+A
    key Enter --modifiers meta # Cmd+Enter on macOS, Ctrl+Enter on others
    ```

    Lands the key event on whatever element currently has DOM focus. Typical workflow:

    ```
    focus
    key Enter
    ```

    Tier

    Write tier (`--allow-write`). Same as `type` and `click`.

    Unblocks

  • Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      enhancementNew feature or request

      Projects

      No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions