Skip to main content

Each command reads one thing of an element, in the page, without changing it. 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 and fails the same way:

sessionIdstringrequired#

The current session’s id.

elementIdstringrequired#

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

StatuserrorWhen
404no such elementThe page does not know the id (no element ... in this page), also after the window loaded another document.
404stale element referenceThe element is no longer in the page.

Get element text#

GET /session/{sessionId}/element/{elementId}/text

Verified on macOS
valuestringrequired#

The element’s innerText (its textContent where it has none).

Get element tag name#

GET /session/{sessionId}/element/{elementId}/name

valuestringrequired#

The tag name in lower case, such as button.

Get element rect#

GET /session/{sessionId}/element/{elementId}/rect

valueobjectrequired#

The element’s box in CSS pixels, from the top left corner of its document (its frame’s, in a frame): getBoundingClientRect() plus the scroll offset. The numbers are not rounded.

Is element enabled#

GET /session/{sessionId}/element/{elementId}/enabled

Verified on macOS
valuebooleanrequired#

false when the element’s disabled property is true; true otherwise, also for elements that have no such property.

Is element selected#

GET /session/{sessionId}/element/{elementId}/selected

valuebooleanrequired#

true when the element is checked (a checkbox or a radio button) or selected (an option).

Is element displayed#

GET /session/{sessionId}/element/{elementId}/displayed

Verified on macOS
valuebooleanrequired#

false when the element’s computed style has display: none, visibility: hidden or opacity: 0, or its box has no width or no height; true otherwise. Click uses the same test.

Get element attribute#

GET /session/{sessionId}/element/{elementId}/attribute/{name}

namestringrequired#

The attribute’s name.

valuestring | nullrequired#

getAttribute(name): the attribute’s value as written in the HTML, or null when the element does not have it.

Get element property#

GET /session/{sessionId}/element/{elementId}/property/{name}

namestringrequired#

The JavaScript property’s name, such as value or checked.

valueanyrequired#

The property’s current value, serialized like a script’s result: elements become references, undefined becomes null.

Get element CSS value#

GET /session/{sessionId}/element/{elementId}/css/{name}

namestringrequired#

The CSS property’s name, such as display or background-color.

valuestringrequired#

getComputedStyle(element).getPropertyValue(name); the empty string for an unknown property.