Skip to content

Instantly share code, notes, and snippets.

@pirate
Last active February 23, 2022 02:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pirate/983322a361416dc630752476ef435b1c to your computer and use it in GitHub Desktop.
Save pirate/983322a361416dc630752476ef435b1c to your computer and use it in GitHub Desktop.
Requested behavior for --full-page CLI option for chrome --headless --screenshot.
const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({width: 1440, height: 1200});
await page.goto('https://example.com', {waitUntil: 'networkidle2'});
await page.screenshot({path: 'screenshot.png', fullPage: true});
await browser.close();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment