press method

Future<void> press(
  1. Key key, {
  2. Duration? delay,
  3. String? text,
})

Focuses the element, and then uses `keyboard.down` and `keyboard.up`.

If key is a single character and no modifier keys besides Shift are being held down, a keypress/input event will also be generated. The text option can be specified to force an input event to be generated.

NOTE Modifier keys DO effect elementHandle.press. Holding down Shift will type the text in upper case.

Parameters:

  • text: If specified, generates an input event with this text.
  • delay: Time to wait between keydown and keyup. Defaults to 0.

Implementation

Future<void> press(Key key, {Duration? delay, String? text}) async {
  await focus();
  await page.keyboard.press(key, delay: delay, text: text);
}