Method: Playwright::Keyboard#down

Defined in:
lib/playwright_api/keyboard.rb

#down(key) ⇒ Object

Dispatches a keydown event.

key can specify the intended [keyboardEvent.key](developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) value or a single character to generate the text for. A superset of the key values can be found [here](developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values). Examples of the keys are:

F1 - F12, Digit0- Digit9, KeyA- KeyZ, Backquote, Minus, Equal, Backslash, Backspace, Tab, Delete, Escape, ArrowDown, End, Enter, Home, Insert, PageDown, PageUp, ArrowRight, ArrowUp, etc.

Following modification shortcuts are also supported: 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 the upper case.

If key is a single character, it is case-sensitive, so the values a and A will generate different respective 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 [‘method: Keyboard.up`].

After the key is pressed once, subsequent calls to [‘method: Keyboard.down`] will have [repeat](developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat) set to true. To release the key, use [`method: Keyboard.up`].

NOTE: Modifier keys DO influence keyboard.down. Holding down Shift will type the text in upper case.



67
68
69
# File 'lib/playwright_api/keyboard.rb', line 67

def down(key)
  wrap_impl(@impl.down(unwrap_impl(key)))
end