Snippet: Get complete HTML of website using Puppeteer

Here a useful Puppeteer snippet I'd like to remember and keep: Get the full HTML content of a website after loading or waiting for networkidle0:

let fullHTML = await page.evaluate(() => document.body.innerHTML);

This assumes you have successfully accessed and waited for the page to load. Common Puppeteer stuff really.

🙏🙏🙏

Since you've made it this far, sharing this article on your favorite social media network would be highly appreciated 💖! For feedback, please ping me on Twitter.

Published