press_key
Dispatch keyboard key presses to interact with web pages, enabling form submission, modal dismissal, focus navigation, and keyboard shortcuts. Returns updated page state for automation.
Instructions
Dispatch a keyboard key press event on the page or a targeted element. Supports named keys (Enter, Escape, Tab, ArrowDown, Backspace) and character keys. Returns post-action page_state reflecting any DOM changes caused by the keypress. Use for form submission (Enter), closing modals (Escape), focus navigation (Tab), or keyboard shortcuts.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"key": "<key>"
},
"name": "press_key"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Key to press — use Playwright key names: "Enter", "Escape", "Tab", "ArrowDown", "ArrowUp", "Backspace", "Space", or single characters like "a". Modifier combos: "Control+a", "Shift+Tab". | |
| widen | No | When true, return the full-page diff instead of scoping to the interacted container. Default: false. | |
| selector | No | Optional CSS selector or @eN ref to focus before pressing the key. If omitted, the key is dispatched to the currently focused element or the page. |