press_key
Simulate keyboard input by sending a key or key combination to a page when fill() cannot handle keyboard shortcuts, navigation keys, or special key combinations.
Instructions
Press a key or key combination. Use this when other input methods like fill() cannot be used (e.g., keyboard shortcuts, navigation keys, or special key combinations). Note: On macOS, native elements cannot be operated with ArrowDown/Enter via press_key; use fill() on the combobox or click() on the option instead.
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": {
"pageId": "<pageId>",
"key": "<key>"
},
"name": "press_key"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | A key or a combination (e.g., "Enter", "Control+A", "Control++", "Control+Shift+R"). Modifiers: Control, Shift, Alt, Meta | |
| pageId | Yes | Targets a specific page by ID. | |
| includeSnapshot | No | Whether to include a snapshot in the response. Default is false. |