Playwright Element Handle
All Element Handle methods available when using the Playwright driver.
Access via elementHandle after launching a Playwright runtime.
How these methods work over HTTP
Every method below is a remote call. The SDK translates it into a structured step sent to a single endpoint:
The call field maps directly to the method name. args is a JSON array of the method’s arguments. You can batch multiple steps in one request.
Actions
click(options?)
Click the element.
This method clicks the element by performing actionability checks, scrolling into view, and simulating a mouse click. Discouraged in favor of locator.click().
dblclick(options?)
Double-click the element.
Discouraged in favor of locator.dblclick().
fill(value, options?)
Fill an input, textarea, or contenteditable element with the specified value.
This method waits for actionability checks, focuses the element, fills it, and triggers an input event. Pass empty string to clear. Discouraged in favor of locator.fill().
type(text, options?)
Focus the element and type text into it character by character.
Deprecated: In most cases use locator.fill() instead. Only use this for special keyboard handling. For special keys use press().
press(key, options?)
Focus the element and press a key or key combination.
Key can be a single character or a special key like “Enter”, “Control+a”, “Shift+ArrowDown”. Discouraged in favor of locator.press().
hover(options?)
Hover over the element.
This method hovers over the element by performing actionability checks, scrolling into view, and simulating mouse hover. Discouraged in favor of locator.hover().
focus()
Focus the element.
Discouraged in favor of locator.focus().
tap(options?)
Tap the element (for touch devices).
This method taps the element by performing actionability checks, scrolling into view, centering, and dispatching touchstart/touchend events. Discouraged in favor of locator.tap().
check(options?)
Check a checkbox or radio element.
If the element is already checked, this method returns immediately. Discouraged in favor of locator.check().
uncheck(options?)
Uncheck a checkbox element.
If the element is already unchecked, this method returns immediately. Discouraged in favor of locator.uncheck().
setChecked(checked, options?)
Check or uncheck a checkbox or radio element.
Discouraged in favor of locator.setChecked().
selectOption(values, options?)
Select one or more options in a <select> element.
Discouraged in favor of locator.selectOption().
Returns string[]
— An array of selected option values.
setInputFiles(files, options?)
Set the files for a file input element.
Sets the value of the file input to these file paths or files. If some paths are relative, they are resolved relative to the current working directory. Clears selected files if empty array is passed. Discouraged in favor of locator.setInputFiles().
scrollIntoViewIfNeeded(options?)
Scroll the element into view if not already visible.
If the element is detached from DOM, throws an error. Discouraged in favor of locator.scrollIntoViewIfNeeded().
dispatchEvent(type, eventInit?)
Dispatch a DOM event on the element.
The event is composed, cancelable and bubbles by default. Regardless of visibility, this will dispatch the event. Discouraged in favor of locator.dispatchEvent().
Queries
contentFrame()
Get the content frame for iframe elements.
Returns RemotePlaywrightFrame \| null
— The frame content, or null if not an iframe.
$(selector)
Query for a child element matching the selector.
Discouraged in favor of locator-based locator.locator().
Returns RemotePlaywrightElementHandle \| null
— The matching element or null if not found.
$$(selector)
Query for all child elements matching the selector.
Discouraged in favor of locator-based locator.locator().
Returns RemotePlaywrightElementHandle[]
— An array of matching elements.
Content
innerHTML()
Get the innerHTML of the element.
Discouraged in favor of locator.innerHTML().
Returns string
innerText()
Get the innerText of the element.
Discouraged in favor of locator.innerText().
Returns string
textContent()
Get the textContent of the element.
Discouraged in favor of locator.textContent().
Returns string \| null
getAttribute(name)
Get an attribute value of the element.
Discouraged in favor of locator.getAttribute().
Returns string \| null
inputValue(options?)
Get the input value for input, textarea, or select elements.
Throws for non-input elements. Discouraged in favor of locator.inputValue().
Returns string
boundingBox()
Get the bounding box of the element.
Discouraged in favor of locator.boundingBox().
Returns PlaywrightBoundingBox \| null
— Bounding box with x, y, width, height, or null if element is not visible.
getProperty(propertyName)
Get a JSHandle for a property of this element.
Note: Returns serialized handle reference. Full JSHandle support not yet available.
Returns unknown
jsonValue()
Get the JSON value of the element.
Throws if the object cannot be serialized to JSON (e.g., DOM nodes).
Returns T
State Checks
isVisible()
Check if the element is visible.
Returns true if element is visible. Non-attached elements return false. Discouraged in favor of locator.isVisible().
Returns boolean
isHidden()
Check if the element is hidden.
Returns true if element is hidden. Non-attached elements return true. Discouraged in favor of locator.isHidden().
Returns boolean
isEnabled()
Check if the element is enabled.
Discouraged in favor of locator.isEnabled().
Returns boolean
isDisabled()
Check if the element is disabled.
Discouraged in favor of locator.isDisabled().
Returns boolean
isChecked()
Check if a checkbox or radio is checked.
Throws if element is not a checkbox or radio. Discouraged in favor of locator.isChecked().
Returns boolean
isEditable()
Check if the element is editable.
Discouraged in favor of locator.isEditable().
Returns boolean
Waiting
waitForElementState(state, options?)
Wait for the element to reach a specific state.
Discouraged in favor of web-first assertions.
waitForSelector(selector, options?)
Wait for a child element matching the selector.
Discouraged in favor of locator-based assertions.
Returns RemotePlaywrightElementHandle \| null
— The matching element, or null if waiting for hidden/detached.
Screenshots & PDF
screenshot(options?)
Take a screenshot of the element.
Returns base64-encoded image data. SDK converts to Buffer. Discouraged in favor of locator.screenshot().
Returns Buffer
Evaluation
evaluate(pageFunction, arg?)
Evaluate a function in the context of the element.
The element is passed as the first argument to the function. If the function returns a Promise, it will be awaited.
Returns R
evaluateHandle(pageFunction, arg?)
Evaluate a function and return a JSHandle to the result.
The element is passed as the first argument. Note: Returns serialized handle reference. Full JSHandle support not yet available.
Returns unknown
$eval(selector, pageFunction, arg?)
Evaluate a function on a child element matching the selector.
Throws if no element matches. Discouraged in favor of locator.evaluate().
Returns R
$$eval(selector, pageFunction, arg?)
Evaluate a function on all child elements matching the selector.
Discouraged in favor of locator.evaluateAll().
Returns R
Other
ownerFrame()
Get the frame that owns this element.
Returns RemotePlaywrightFrame \| null
— The owner frame, or null if element is detached.
asElement()
Return this handle as an ElementHandle.
Since this is already an ElementHandle, returns itself.
Returns RemotePlaywrightElementHandle \| null
dispose()
Dispose of the handle, releasing it from the browser.
After disposal, any method calls will throw. The SDK sets the disposed flag before the RPC call to prevent race conditions.
getProperties()
Get a map of property names to JSHandles.
Returns Map<string, RemotePlaywrightJSHandle>

