press_key
Press a single keyboard key, including special keys and modifiers. Optionally focus an element with a CSS or XPath selector before pressing.
Instructions
Press a single keyboard key with optional modifiers. Use this for special keys: Enter, Tab, Escape, arrows, function keys, or keyboard shortcuts. Does NOT type text - use type_text for that.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | Key name: "Enter", "Tab", "Escape", "Backspace", "ArrowUp/Down/Left/Right", "a", "F1-F12" | |
| modifiers | No | Modifier keys to hold (e.g., ["Control"] for Ctrl+C). Use Meta for Command on Mac. | |
| selector | No | CSS/XPath selector to focus before pressing key - use this to avoid needing to click first | |
| selectorType | No | Selector type: "css" (default) or "xpath" | |
| tabId | No | Target tab ID (defaults to active tab) | |
| apiKey | No | API key for authentication if enabled |