press method
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 downShift
will type the text in upper case.
Parameters:
text
: If specified, generates an input event with this text.delay
: Time to wait betweenkeydown
andkeyup
. 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);
}