The following APIs don't have one-to-one equivalents in a real user
Their behavior is therefore an interpretation how the "perceived" user interaction might be translated to actual events on the DOM.
This API can be used to easily clear an editable element.
- Focus element
- Select all contents as per browser menu
- Delete contents as per browser menu
Promise is rejected if the element can not be focused or contents can not
values parameter can refer to an option per its value, HTML content or
just provide the element. It also accepts an array of these.
Selecting multiple options and/or deselecting options of
HTMLSelectElementis only possible if multiple is specified.
Note that this API triggers pointer events and is therefore subject to pointerEventsCheck.
Type into an input element.
You should use
keyboard()if you want to just simulate pressing buttons on the keyboard.
You can use
type()if you just want to conveniently insert some text into an input field or textarea.
true, click the element.
initialSelectionStartis set, set the selection on the element. If
initialSelectionEndis not set, this results in a collapsed selection.
- Type the given
true, release all pressed keys.
Change a file input as if a user clicked it and selected files in the resulting file upload dialog.