Skip to main content

Clicks and typing are simulated in the page with page script and DOM events, not OS-level input: the mouse and the keyboard are never used. For key-by-key input with modifiers, use actions. Paths follow http://127.0.0.1:4445/{token}; see the overview for the reply format and the errors.

Every command here takes the same path parameters, answers null, and answers 404 no such element or 404 stale element reference for an element the page does not know or that is gone:

sessionIdstringrequired#

The current session’s id.

elementIdstringrequired#

The element’s id, from a find or a script.

Element click#

POST /session/{sessionId}/element/{elementId}/click

Verified on macOS

Scrolls the element to the middle of the view at once (also when the page sets scroll-behavior: smooth), checks that it is displayed, focuses it, and calls its click(). The page sees a click event, without pointer or mouse down and up events before it (use actions for those). Whether another element covers it is not checked.

valuenullrequired#

null.

Errors

StatuserrorWhen
400element not interactableThe element is not displayed (the element is not visible).

Element clear#

POST /session/{sessionId}/element/{elementId}/clear

Verified on macOS

Sets the element’s value to the empty string (its text, for an editable element) through the native value setter, which React and similar frameworks watch, then fires input and change.

valuenullrequired#

null.

Element send keys#

POST /session/{sessionId}/element/{elementId}/value

Verified on macOS

Focuses the element and adds the text at the end of its value (its text, for an editable element) through the native value setter, then fires input and change once. The page sees no key events for the text.

The WebDriver Enter key, \uE007, is taken out of the text: when the text holds one, the element then gets keydown, keypress and keyup for Enter and its form is submitted (requestSubmit). Other WebDriver key codes are not read here; they are added as characters.

textstring#

The text to type. Required unless value is given.

valuestring[]#

The older form: the text as an array of strings, joined. Read only when text is missing.

valuenullrequired#

null.

Errors

StatuserrorWhen
400invalid argumentNeither text nor a value array (`text` is missing).