new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Playwright · API reference · all subjects

keyboard/methods

5 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Keyboard.down method

The async Keyboard.down method dispatches a keydown event. It takes one required parameter: key (string) - the name of the key to press or a character to generate, such as ArrowLeft or a. The key parameter can specify the intended keyboardEvent.key value or a single character. Supported keys include F1-F12, Digit0-Digit9, KeyA-KeyZ, Backquote, Minus, Equal, Backslash, Backspace, Tab, Delete, Escape, ArrowDown, End, Enter, Home, Insert, PageDown, PageUp, ArrowRight, ArrowUp. Modification shortcuts supported are: Shift, Control, Alt, Meta, ShiftLeft, ControlOrMeta. ControlOrMeta resolves to Control on Windows and Linux and to Meta on macOS. Holding down Shift will type the text that corresponds to the key in upper case. If key is a single character, it is case-sensitive, so a and A will generate different texts. If key is a modifier key (Shift, Meta, Control, or Alt), subsequent key presses will be sent with that modifier active. To release the modifier key, use Keyboard.up. After the key is pressed once, subsequent calls to Keyboard.down will have repeat set to true. To release the key, use Keyboard.up. Modifier keys DO influence keyboard.down; holding down Shift will type the text in upper case.

Keyboard.insertText method

The async Keyboard.insertText method dispatches only an input event and does not emit keydown, keyup, or keypress events. It takes one required parameter: text (string) - the text to set as input to the specified text value. Modifier keys DO NOT affect keyboard.insertText; holding down Shift will not type the text in upper case.

Keyboard.press method

The async Keyboard.press method is a shortcut for Keyboard.down and Keyboard.up combined. It takes one required parameter: key (string) - the name of the key to press or a character to generate, such as ArrowLeft or a. The key parameter can specify the intended keyboardEvent.key value or a single character. Supported keys include F1-F12, Digit0-Digit9, KeyA-KeyZ, Backquote, Minus, Equal, Backslash, Backspace, Tab, Delete, Escape, ArrowDown, End, Enter, Home, Insert, PageDown, PageUp, ArrowRight, ArrowUp. Modification shortcuts supported are: Shift, Control, Alt, Meta, ShiftLeft, ControlOrMeta. ControlOrMeta resolves to Control on Windows and Linux and to Meta on macOS. Shortcuts such as Control+o, Control+Shift+T are supported; when specified with the modifier, the modifier is pressed and held while the subsequent key is being pressed. It also takes one optional parameter: delay (float) - time to wait between keydown and keyup in milliseconds. Defaults to 0. In most cases, you should use Locator.press instead.

Keyboard.type method

The async Keyboard.type method sends a keydown, keypress/input, and keyup event for each character in the text. It takes one required parameter: text (string) - a text to type into a focused element. It also takes one optional parameter: delay (float) - time to wait between key presses in milliseconds. Defaults to 0. To press a special key like Control or ArrowDown, use Keyboard.press instead. Modifier keys DO NOT affect keyboard.type; holding down Shift will not type the text in upper case. For characters that are not on a US keyboard, only an input event will be sent. In most cases, you should use Locator.fill instead. You only need to press keys one by one if there is special keyboard handling on the page, in which case use Locator.pressSequentially.

Keyboard.up method

The async Keyboard.up method dispatches a keyup event. It takes one required parameter: key (string) - the name of the key to press or a character to generate, such as ArrowLeft or a.

Give your agent this brain