My current code is as follows:
import puppeteer from 'puppeteer';
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('https://running2win.com');
await page.screenshot({path: 'home.jpg', type: 'jpeg', fullPage: true});
await page.waitForSelector('html');
const all = await page.evaluate(() => {
const all = document.querySelectorAll('html');
return all;
});
console.log(all);
await browser.close();
})();
I'm simply trying to troubleshoot by printing out all the html on the page. Instead it prints out:
{ '0': {} }
I suspect this may be related to the website I am trying to scrape.
I tried running the querySelector in the browser console and it functions as expected, returning all the html.