press_keys
Send real keystrokes to the page to trigger keyboard events that form-field filling misses. Type text or press keys like Enter, ArrowDown, and Control+A for games, canvas editors, and shortcut-driven UIs.
Instructions
Send real keystrokes to the page, rather than into a form field.
fill_field writes into an <input>. This types at whatever holds keyboard
focus, which is what word games, canvas editors (Figma, Excalidraw),
terminal emulators, and keyboard-shortcut UIs actually listen to: they bind
keydown/keyup on window or document, so setting an input's value
never reaches them and there is often no input to target in the first place.
Examples: press_keys(text="crane", keys=["Enter"]) # type a word, submit it press_keys(keys=["ArrowDown"], repeat=3) # move a selection press_keys(keys=["Control+a", "Backspace"]) # select all, clear press_keys(text="hello", selector="#chat") # focus first, then type
Args:
text: Literal text to type one character at a time, firing the full
keydown → keypress → input → keyup sequence per character. Typed
BEFORE keys, so text="crane", keys=["Enter"] does the right thing.
keys: Key names pressed in order — ["Enter"], ["Escape"], ["ArrowLeft"] —
or chords like ["Control+a"], ["Shift+Tab"]. Playwright names:
Enter, Tab, Escape, Backspace, Delete, ArrowUp/Down/Left/Right,
Home, End, PageUp, PageDown, F1–F12, and single characters.
selector: CSS selector to focus first. Omit to send keys to whatever
already has focus — the usual case for games and canvas apps.
delay_ms: Milliseconds per keystroke (0–1000). 0 is fastest; use 20–80
on sites that check typing cadence.
repeat: Press the keys sequence this many times (1–50). Does not
repeat text.
wait_for: CSS selector to wait for afterwards, in this same call.
wait_for_predicate: JS expression polled until truthy afterwards.
wait_until: Readiness signal afterwards — 'none' (default), 'dom_settled'
(wait for the DOM to stop changing; prefer this over a fixed
sleep), 'networkidle', 'load', 'domcontentloaded', 'settle'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| keys | No | ||
| text | No | ||
| repeat | No | ||
| delay_ms | No | ||
| selector | No | ||
| wait_for | No | ||
| wait_until | No | none | |
| wait_for_predicate | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |