Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: keyboard

[8:14] (extern: com.lehman.aussom.AKeyboard) extends: object

The keyboard class provides low-level keyboard input simulation for a page. Instances are obtained via page.keyboard(). Use locator.press() or locator.fill() for higher-level input; use keyboard for raw key sequences.

Methods

  • down (string Key)

    Dispatches a keydown event for the given key, followed by keypress if appropriate. The key is held down until up() or press() is called.

    • @p Key is a string key name (e.g. 'Shift', 'Control', 'ArrowLeft').
    • @r This object.
  • up (string Key)

    Dispatches a keyup event for the given key.

    • @p Key is a string key name.
    • @r This object.
  • press (string Key)

    Dispatches keydown, keypress/input, and keyup events for the given key in sequence. Shorthand for down() followed immediately by up().

    • @p Key is a string key name or combination (e.g. 'Enter', 'Control+a').
    • @r This object.
  • type (string Text)

    Sends a keydown, input, and keyup sequence for each character in the provided text string.

    • @p Text is a string of characters to type.
    • @r This object.
  • insertText (string Text)

    Dispatches an input event with the given text. Does not fire keydown or keyup events. Use for pasting text into a focused element.

    • @p Text is a string of characters to insert.
    • @r This object.