Skip to main content
Element Handle content methods for the Playwright driver.

innerHTML

Get the innerHTML of the element.
Discouraged in favor of locator.innerHTML().
Upstream docs
result
string
Return value
await element.innerHTML();

innerText

Get the innerText of the element.
Discouraged in favor of locator.innerText().
Upstream docs
result
string
Return value
await element.innerText();

textContent

Get the textContent of the element.
Discouraged in favor of locator.textContent().
Upstream docs
result
string | null
Return value
await element.textContent();

getAttribute

Get an attribute value of the element.
Discouraged in favor of locator.getAttribute().
Upstream docs
name
string
required
Attribute name to get.
result
string | null
Return value
await element.getAttribute('...');

inputValue

Get the input value for input, textarea, or select elements.
Throws for non-input elements. Discouraged in favor of locator.inputValue().
Upstream docs
options
PlaywrightTimeoutOptions
result
string
Return value
await element.inputValue();

getProperty

Get a JSHandle for a property of this element.
Note: Returns serialized handle reference. Full JSHandle support not yet available.
Upstream docs
propertyName
string
required
result
unknown
Return value
await element.getProperty('...');

jsonValue

Get the JSON value of the element.
Throws if the object cannot be serialized to JSON (e.g., DOM nodes).
Upstream docs
result
unknown
Return value
await element.jsonValue();