Arguments to pass to fn
The only difference between evaluate
and evaluateHandle
is that evaluateHandle
returns in-page object (JSHandle
).
If the function, passed to the evaluateHandle
, returns a Promise
, then evaluateHandle
would wait for the
promise to resolve and return its value.
The TypeScript definitions assume that evaluateHandle
returns a JSHandle
, but if you know it's going to return an
ElementHandle
, pass it as the generic argument:
a function that is run within the page
arguments to be passed to the pageFunction
Generated using TypeDoc
Evaluates a function in the browser context. If the function, passed to the frame.evaluate, returns a Promise, then frame.evaluate would wait for the promise to resolve and return its value. If the function passed into frame.evaluate returns a non-Serializable value, then frame.evaluate resolves to undefined.