mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: refactor JSHandle and ExecutionContext (#8773)
This commit is contained in:
@@ -4,7 +4,7 @@ sidebar_label: JSHandle.evaluate
|
||||
|
||||
# JSHandle.evaluate() method
|
||||
|
||||
This method passes this handle as the first argument to `pageFunction`. If `pageFunction` returns a Promise, then `handle.evaluate` would wait for the promise to resolve and return its value.
|
||||
Evaluates the given function with the current handle as its first argument.
|
||||
|
||||
**Signature:**
|
||||
|
||||
@@ -32,10 +32,3 @@ class JSHandle {
|
||||
**Returns:**
|
||||
|
||||
Promise<Awaited<ReturnType<Func>>>
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
const tweetHandle = await page.$('.tweet .retweets');
|
||||
expect(await tweetHandle.evaluate(node => node.innerText)).toBe('10');
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user