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:
The current session’s id.
| Status | error | When |
|---|---|---|
| 404 | no such element | The page does not know the id (no element ... in this page), also after the window loaded another document. |
| 404 | stale element reference | The element is no longer in the page. |
Get element text#
GET /session/{sessionId}/element/{elementId}/text
The element’s innerText (its textContent where it has none).
Get element tag name#
GET /session/{sessionId}/element/{elementId}/name
The tag name in lower case, such as button.
Get element rect#
GET /session/{sessionId}/element/{elementId}/rect
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
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
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
Get element attribute#
GET /session/{sessionId}/element/{elementId}/attribute/{name}
The attribute’s name.
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}
The JavaScript property’s name, such as value or checked.
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}
The CSS property’s name, such as display or background-color.
getComputedStyle(element).getPropertyValue(name); the empty string for an
unknown property.