1

I am new to using Puppeteer and I am trying to scrape some store hour information from a store website. When you open the section that has this information, there is a scroll bar (not the actual browser one) that you need to scroll all the way down to the bottom to load all of the data. Currently, I am extracting all the data on the page using the code from user codetinker from this stack overflow answer.

It is:

const puppeteer = require('puppeteer');

(async function main() {
  try {
    const browser = await puppeteer.launch();
    const [page] = await browser.pages();

    await page.goto('https://netto.dk/find-butik/?mapData={%22coordinates%22:{%22lat%22:54.41413535660238,%22lng%22:13.985595703125002},%22zoom%22:7,%22input%22:%22%22}', { waitUntil: 'networkidle0' });
    const data = await page.evaluate(() => document.querySelector('*').outerHTML);

    console.log(data);

    await browser.close();
  } catch (err) {
    console.error(err);
  }
})();

But this doesn't work, as the sub scrollbar hasn't been scrolled all the way down when Puppeteer does its magic.

What I want to accomplish is have Puppeteer scroll all the way down in this "sub" scrollbar so I can scrape all the data I need. Is there any way to accomplish this?

atk9022
  • 97
  • 6

0 Answers0