The Keyboard class provides methods to simulate keyboard input such as typing text and pressing keys. Access the Keyboard instance throughDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/microsoft/playwright/llms.txt
Use this file to discover all available pages before exploring further.
page.keyboard.
Methods
type
Types text character by character.The text to type
Time to wait between key presses in milliseconds. Defaults to 0.
press
Presses a single key or a key combination.The key or key combination to press. See key values for valid values.
Time to wait between keydown and keyup in milliseconds. Defaults to 0.
down
Holds down a key.The key to hold down. See key values for valid values.
up
Releases a key.The key to release. See key values for valid values.
insertText
Inserts text without simulating key presses.The text to insert
This method dispatches an
input event directly, which is much faster than type() but does not trigger keydown, keypress, or keyup events.