docs: fix cross-browser.js example (#9291)

The previous selector is broken as of ~2 months ago, c.f.
https://news.ycombinator.com/item?id=33027700

Changed from:

    <a class="titlelink"></a>

To:

    <span class="titleline">
    <a></a>
    </span>
This commit is contained in:
Thiago Perrotta 2022-11-17 13:26:08 +01:00 committed by GitHub
parent 078d385671
commit b6ffa732ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 = '.titlelink'; const resultsSelector = '.titleline > a';
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 => {