Of the 2 Keyboard methods, browser sessions serve 2, phone sessions 2 and computer sessions 2. A method marked not served answers StrategyUnavailable on that kind of session; check the handshake’s capabilities before relying on one.

Keyboard.typeText

Browser: served Phone: served Computer: served Takes targetId Type text into whatever has focus.
{"id": 1, "method": "Keyboard.typeText", "params": {"text": "hello"}}
ParamTypeRequiredDescription
textstringYes
inputstringNoHow the input reaches the page. Browsers serve os (the default), real operating system input; simulated answers StrategyUnavailable.
delayMsintegerNoThe pause between keys, as Playwright’s pressSequentially delay. Omitted or 0 types at the default pace. From 0 to 1000.
idempotencyKeystringNoMakes a re-send after a reconnect safe: a repeated key returns the recorded response without acting again. See Idempotency keys.
Result: an empty object {}.

Keyboard.keyPress

Browser: served Phone: served Computer: served Takes targetId Press and release one key on whatever has focus, holding any modifiers for the press. key is a named key or a single printable character (for chords such as ctrl+a). Text is sent with Keyboard.typeText, not as key presses.
{"id": 1, "method": "Keyboard.keyPress", "params": {"key": "enter"}}
ParamTypeRequiredDescription
keystringYesA named key, or a single printable character. Playwright’s spellings of named keys (“Enter”, “ArrowDown”, “PageUp”) are accepted too.
modifiersstring[]NoModifier keys to hold. A session that cannot hold modifiers answers StrategyUnavailable. One of ctrl, shift, alt, meta.
inputstringNoHow the input reaches the page. Browsers serve os (the default), real operating system input; simulated answers StrategyUnavailable.
idempotencyKeystringNoMakes a re-send after a reconnect safe: a repeated key returns the recorded response without acting again. See Idempotency keys.
Result: an empty object {}.