Skip to content

Instantly share code, notes, and snippets.

@w3collective
Created September 15, 2022 06:38
Show Gist options
  • Save w3collective/5155e981cb6672150184183461347e64 to your computer and use it in GitHub Desktop.
Save w3collective/5155e981cb6672150184183461347e64 to your computer and use it in GitHub Desktop.
Capture website screenshots using Node.js and Puppeteer
const puppeteer = require("puppeteer");
const capture = async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.setViewport({ width: 1024, height: 768 });
await page.goto("https://www.wikipedia.org/");
await page.screenshot({ path: "./screenshot.png" });
await browser.close();
};
capture();
@w3collective
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment