page.evaluateHandle() method.
page.evaluate().
Methods
evaluate
Evaluates a function in the browser context with this handle as the first argument.function
required
Function to be evaluated in the page context
any
Optional argument to pass to the function
Promise<R> - Promise that resolves to the return value of the function
evaluateHandle
Evaluates a function in the browser context with this handle as the first argument, returns a JSHandle.function
required
Function to be evaluated
any
Optional argument to pass to the function
Promise<JSHandle> - Promise that resolves to a JSHandle
getProperty
Fetches a single property from the referenced object.string
required
Name of the property to get
Promise<JSHandle> - Promise that resolves to a JSHandle of the property value
getProperties
Returns a map with property names as keys and JSHandle instances for property values. Returns:Promise<Map<string, JSHandle>> - Map of property names to JSHandles
jsonValue
Returns a JSON representation of the object. If the object has atoJSON function, it will not be called.
Returns: Promise<T> - JSON representation of the object
asElement
Returns eithernull or the object handle itself if the object is an instance of Node.
Returns: ElementHandle | null - ElementHandle pointing to the referenced object or null
dispose
Stops referencing the element handle and disposes it. Returns:Promise<void>
Examples
Working with object properties
Passing JSHandles to evaluate
Working with arrays
Related
- Page.evaluateHandle() - Create a JSHandle
- ElementHandle - Subclass representing DOM elements
- Frame.evaluateHandle() - Evaluate and get JSHandle in frame
