sidebar_label |
---|
Frame.type |
Sends a keydown
, keypress
/input
, and keyup
event for each character in the text.
class Frame {
type(
selector: string,
text: string,
options?: Readonly<KeyboardTypeOptions>
): Promise<void>;
}
Parameter |
Type |
Description |
---|---|---|
selector |
string |
the selector for the element to type into. If there are multiple the first will be used. |
text |
string |
text to type into the element |
options |
Readonly<KeyboardTypeOptions> |
(Optional) takes one option, |
Promise<void>
To press a special key, like Control
or ArrowDown
, use Keyboard.press().
await frame.type('#mytextarea', 'Hello'); // Types instantly
await frame.type('#mytextarea', 'World', {delay: 100}); // Types slower, like a user