Skip to content

Commit f8d01e1

Browse files
committed
readme: update exemple t odump links
1 parent cd429f5 commit f8d01e1

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,20 @@ const browser = await puppeteer.connect({
8383
const context = await browser.createBrowserContext();
8484
const page = await context.newPage();
8585

86+
// Dump all the links from the page.
8687
await page.goto('https://wikipedia.com/');
8788

89+
const links = await page.evaluate(() => {
90+
return Array.from(document.querySelectorAll('a')).map(row => {
91+
return row.getAttribute('href');
92+
});
93+
});
94+
95+
console.log(links);
96+
8897
await page.close();
8998
await context.close();
99+
await browser.disconnect();
90100
```
91101

92102
## Build from sources

0 commit comments

Comments
 (0)