press_key
Press a key in the active browser tab, optionally focusing a selector first, to trigger actions such as form submission.
Instructions
Press a key via CDP keyboard input in the session's active tab. key is a name (Enter, Tab, Escape, Backspace, ArrowDown, …) or a single character. With a selector, waits up to timeout for it and focuses it first (e.g. type into a field then press Enter); without, presses on whatever is focused, and timeout is unused. Use type for whole strings and click to activate buttons. Pressing Enter can submit a form, like a real user. Returns a confirmation. Fails on an unknown key name, or if the selector matches nothing within timeout.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Key name in the US layout (Enter, Tab, Escape, Backspace, ArrowDown…) or one character. | |
| timeout | No | Milliseconds to wait for `selector` to appear. Default 5000. | |
| selector | No | CSS selector of an element to focus before pressing. Omit to press on the focused element. | |
| sessionId | Yes | The id returned by open_browser_session. Errors if no open session has it. |