evaluateHandle<T extends JsHandle> method

Future<T> evaluateHandle<T extends JsHandle>(
  1. @Language('js') String pageFunction, {
  2. List? args,
})

This method passes this handle as the first argument to pageFunction.

The only difference between jsHandle.evaluate and jsHandle.evaluateHandle is that executionContext.evaluateHandle returns in-page object (JSHandle).

If the function passed to the jsHandle.evaluateHandle returns a Promise, then jsHandle.evaluateHandle would wait for the future to resolve and return its value.

See Page.evaluateHandle for more details.

Parameters:

  • pageFunction: Function to be evaluated

Implementation

//  - `args`: Arguments to pass to `pageFunction`
//  Returns: Future which resolves to the return value of `pageFunction` as in-page object (JSHandle)
Future<T> evaluateHandle<T extends JsHandle>(
    @Language('js') String pageFunction,
    {List<dynamic>? args}) {
  return executionContext
      .evaluateHandle(pageFunction, args: [this, ...?args]);
}