Keyboard
keyboard.down
Signature: keyboard.down(keyInput)
keyInput<KeyInput> Name of key to press, such asArrowLeft. See KeyInput for a list of all key names.
Returns <Promise<void>>
Dispatches a keydown event.
keyboard.up
Signature: keyboard.up(keyInput)
keyInput<KeyInput> Name of key to press, such asArrowLeft. See KeyInput for a list of all key names.
Returns <Promise<void>>
Dispatches a keyup event.
keyboard.press
Signature: keyboard.press(keyInput, options?)
keyInput<KeyInput> Name of key to press, such asArrowLeft. See KeyInput for a list of all key names.options?<object> An object of options.delay?<number> Time to wait between keydown and keyup in milliseconds. Defaults to 0.
Returns <Promise<void>>
Shortcut for Keyboard.down and Keyboard.up.
keyboard.type
Signature: keyboard.type(text, options?)
text<string> A text to type into a focused element.options?<object> An object of options.delay?<number> Time to wait between keydown and keyup in milliseconds. Defaults to 0.
Returns <Promise<void>>
Sends a keydown, keypress/input, and keyup event for each character in the text.
Example
await page.keyboard.type('Hello'); // Types instantly
await page.keyboard.type('World', {delay: 100}); // Types slower, like a user
keyboard.input
Signature: keyboard.input(text)
text<string> Sets input to the specified text value.
Returns <Promise<void>>
Dispatches only input event, does not emit the keydown, keyup or keypress events.