docs(api): add example to page.$$eval (#5200)
This makes it more clear that the callback receives an actual array of nodes instead of just a NodeList. Co-authored-by: Mathias Bynens <mathias@qiwi.be>
This commit is contained in:
parent
b45f8e4703
commit
c283fea6c5
@ -1111,7 +1111,11 @@ If `pageFunction` returns a [Promise], then `page.$$eval` would wait for the pro
|
|||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
```js
|
```js
|
||||||
const divsCounts = await page.$$eval('div', divs => divs.length);
|
const divCount = await page.$$eval('div', divs => divs.length);
|
||||||
|
```
|
||||||
|
|
||||||
|
```js
|
||||||
|
const options = await page.$$eval('div > span.options', options => options.map(option => option.textContent));
|
||||||
```
|
```
|
||||||
|
|
||||||
#### page.$eval(selector, pageFunction[, ...args])
|
#### page.$eval(selector, pageFunction[, ...args])
|
||||||
|
Loading…
Reference in New Issue
Block a user