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:
Feu 2020-01-27 12:19:33 -03:00 committed by Mathias Bynens
parent b45f8e4703
commit c283fea6c5

View File

@ -1111,7 +1111,11 @@ If `pageFunction` returns a [Promise], then `page.$$eval` would wait for the pro
Examples:
```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])