evaluate<T> method
This method passes this handle as the first argument to pageFunction
.
If pageFunction
returns a Future, then handle.evaluate
would wait
for the promise to resolve and return its value.
Examples:
var tweetHandle = await page.$('.tweet .retweets');
expect(await tweetHandle.evaluate('node => node.innerText'), '10');
Parameters:
pageFunction
Function to be evaluated in browser contextargs
Arguments to pass topageFunction
- returns: Future which resolves to the return value of
pageFunction
Implementation
Future<T?> evaluate<T>(@Language('js') String pageFunction,
{List<dynamic>? args}) {
return executionContext.evaluate(pageFunction, args: [this, ...?args]);
}