Skip to main content
Page evaluation methods for the Playwright driver.

evaluate

Evaluate JavaScript in the page context. Upstream docs
pageFunction
string
required
arg
unknown
result
unknown
Return value
await page.evaluate('...');

evaluateHandle

Evaluate JavaScript and return a handle to the result. Upstream docs
pageFunction
string
required
arg
unknown
result
SerializedHandle
Return value
await page.evaluateHandle('...');

$eval

Find an element matching the selector and evaluate a function on it.
Deprecated: This method does not wait for the element to pass actionability checks. Use locator.evaluate() instead.
Upstream docs
selector
string
required
pageFunction
string
required
arg
unknown
result
unknown
Return value
await page.$eval('...', '...');

$$eval

Find all elements matching the selector and evaluate a function on the array of elements.
Deprecated: This method does not wait for elements to pass actionability checks. Use locator.evaluateAll() instead.
Upstream docs
selector
string
required
pageFunction
string
required
arg
unknown
result
unknown
Return value
await page.$$eval('...', '...');