How to get page HTML source code in Puppeteer

In order to get the current page HTML source code (i.e. not the source code received from the server, but the currently loaded source code including Javascript modifications), use

example-2.js

Full example based on Puppeteer minimal example:

example-1.js
const puppeteer = require('puppeteer');
(async () => {
  const browser = await puppeteer.launch();
  const page = await browser.newPage();
  await page.goto('https://techoverflow.net', {waitUntil: 'domcontentloaded'});
  // Get page source code and log it to console
  console.log(await page.content());
  // Cleanup
  await browser.close();
})();

Check out similar posts by category: Javascript, NodeJS, Puppeteer