mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
docs: update example to align with the website (#7788)
Update example to align with the website. `news.ycombinator.com` uses class `.titlelink`.
This commit is contained in:
parent
5cf6f5f6cb
commit
f7c59223ae
@ -34,7 +34,7 @@ const firefoxOptions = {
|
|||||||
await page.goto('https://news.ycombinator.com/');
|
await page.goto('https://news.ycombinator.com/');
|
||||||
|
|
||||||
// Extract articles from the page.
|
// Extract articles from the page.
|
||||||
const resultsSelector = '.storylink';
|
const resultsSelector = '.titlelink';
|
||||||
const links = await page.evaluate((resultsSelector) => {
|
const links = await page.evaluate((resultsSelector) => {
|
||||||
const anchors = Array.from(document.querySelectorAll(resultsSelector));
|
const anchors = Array.from(document.querySelectorAll(resultsSelector));
|
||||||
return anchors.map((anchor) => {
|
return anchors.map((anchor) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user