type method

Future<void> type(
  1. String text, {
  2. Duration? delay,
})

Focuses the element, and then sends a keydown, keypress/input, and keyup event for each character in the text.

To press a special key, like Control or ArrowDown, use `elementHandle.press`.

await elementHandle.type('Hello'); // Types instantly

// Types slower, like a user
await elementHandle.type('World', delay: Duration(milliseconds: 100));

///---

An example of typing into a text field and then submitting the form:

var elementHandle = await page.$('input');
await elementHandle.type('some text');
await elementHandle.press(Key.enter);

Implementation

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