Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Keyboard

Keyboard class provides methods to emulate keyboard input

Hierarchy

  • Keyboard

Index

Constructors

Methods

Object literals

Constructors

constructor

Methods

pressKey

  • pressKey presses and holds a single Key for Key combinations Modifier Keys are to be given in "natural" ordering, so first modifier Keys, followed by the Key to press

    example
       // Will press and hold key combination STRG + V
       await keyboard.pressKey(Key.STRG, Key.A);

    Parameters

    • Rest ...keys: Key[]

      Array of Keys to press and hold

    Returns Promise<Keyboard>

releaseKey

  • pressKey releases a single Key for Key combinations Modifier Keys are to be given in "natural" ordering, so first modifier Keys, followed by the Key to press

    example
       // Will release key combination STRG + V
       await keyboard.releaseKey(Key.STRG, Key.A);

    Parameters

    • Rest ...keys: Key[]

      Array of Keys to release

    Returns Promise<Keyboard>

type

  • type types a sequence of {@link String} or single Keys via system keyboard

    example
       await keyboard.type(Key.A, Key.S, Key.D, Key.F);
       await keyboard.type("Hello, world!");

    Parameters

    • Rest ...input: StringOrKey

      Sequence of {@link String} or Key to type

    Returns Promise<Keyboard>

Object literals

config

config: object

Config object for Keyboard class

autoDelayMs

autoDelayMs: number = 300

Configures the delay between single key events