send_hotkey method

Future<Online> send_hotkey(
  1. Key key, {
  2. List<Key>? modifiers,
})

Implementation

Future<Online> send_hotkey(Key key, {List<Key>? modifiers}) async {
  if (modifiers != null) {
    for (var modifier in modifiers) {
      await (await page).keyboard.down(modifier);
    }
    await Future.delayed(Duration(milliseconds: 200));
    await (await page).keyboard.press(key);
    await Future.delayed(Duration(milliseconds: 200));

    for (var modifier in modifiers) {
      await (await page).keyboard.up(modifier);
    }
  } else {
    await (await page).keyboard.press(key);
  }

  return this;
}