To install Puppeteer in Visual Studio Code, first install Node.js, open a fresh VS Code terminal, then run npm i puppeteer in your project folder. Puppeteer downloads a compatible Chrome for Testing browser; after that, a short Node.js script can open a page and save a screenshot. VS Code is the editor, while Node.js runs the script and npm installs its dependencies.
Before you install Puppeteer
Install Node.js for your operating system, then open a new VS Code window and integrated terminal. A fresh terminal matters because it needs to pick up the Node.js and npm entries on your system PATH. In VS Code, open the integrated terminal from Terminal > New Terminal, then verify both commands:
node --version
npm --version
Each command should print a version number. If either command is not recognized, install or repair Node.js and open another new terminal before continuing. Microsoft’s Node.js tutorial for VS Code covers the editor and terminal setup.
Create a project and install Puppeteer
- In VS Code, choose File > Open Folder and open an existing project folder, or create and open a new one.
- In the integrated terminal, move into that folder if necessary. If it does not already contain a package manifest, create one with
npm init -y. - Install Puppeteer with
npm i puppeteer.
The puppeteer package downloads a compatible Chrome for Testing browser and a chrome-headless-shell. The default browser cache is $HOME/.cache/puppeteer. Puppeteer’s documented approximate Chrome for Testing download sizes are 170 MB on macOS, 282 MB on Linux, and 280 MB on Windows; these are documentation estimates, not a benchmark for your connection or disk.
#1 Best Overall
- 14" diagonal, 1366x768 resolution, HD BrightView LED, Glossy NON-TOUCH Display
Some package managers block dependency install scripts. If installation finishes but no browser is available, run:
npx puppeteer browsers install
Alternatively, permit Puppeteer’s install script in your package manager, then run the browser installation command. The Puppeteer installation guide explains its browser download and configuration.
Write and run a full-page screenshot script
Create a file named screenshot.mjs in the project folder. This complete ES module opens a page, waits for network activity to settle, saves a full-page PNG and closes the browser even if navigation or capture fails:
import puppeteer from 'puppeteer';
const browser = await puppeteer.launch();
try {
const page = await browser.newPage();
await page.goto('https://example.com', { waitUntil: 'networkidle2' });
await page.screenshot({ path: 'screenshot.png', fullPage: true });
} finally {
await browser.close();
}
Run it from the integrated terminal with node screenshot.mjs. On success, screenshot.png appears in the current project directory. The script uses top-level await, supported in .mjs files. If you prefer CommonJS, save the file as screenshot.cjs and use const puppeteer = require('puppeteer');; put the rest of the asynchronous script inside an async function and call it.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteRank #2
- 1.1 GHz (boost up to 2.4GHz) Intel Celeron N5030 Quad-Core
- 4GB DDR4 System Memory; 128GB Solid State Drive
- 11.6" HD (1366 x 768) Multi-Touch Display
- Combo headphone/microphone jack - Noble Wedge Lock slot - HDMI; 2 USB 3.1 Gen 1
- Windows 11 Pro
Choose a wait condition for the target site
networkidle2 is the wait condition used in Puppeteer’s screenshot example, but it is not a universal signal that every page is visually complete. A site that continually polls, streams data or loads content after user interaction may never become network-idle, or may still have unfinished content after it does. Choose a condition that matches the page: domcontentloaded for an early document-ready capture, load when the page’s load event is appropriate, or networkidle2 when network quiet is a useful proxy. For a specific application, wait for its meaningful selector or readiness signal before capturing.
Viewport, full-page and element captures
By default, page.screenshot() captures the current viewport. Set fullPage: true when you want the document’s full scrollable height. A full-page image can be much taller and larger than a viewport capture, so use it only when the whole document is needed. To capture one rendered component instead, locate it and call its element screenshot method:
const card = await page.waitForSelector('.product-card');
await card.screenshot({ path: 'product-card.png' });
Replace .product-card with a selector that exists on the target page. The Puppeteer screenshots guide documents Page.screenshot(), full-page capture and element screenshots.
Choose between Puppeteer and puppeteer-core
| Package | Browser management | Choose it when |
|---|---|---|
puppeteer |
Downloads a compatible Chrome for Testing browser as part of setup. | You want the standard local setup and Puppeteer-managed browser version. |
puppeteer-core |
Does not download Chrome. | Your project manages a system browser, remote browser or centrally managed binary. |
For puppeteer-core, provide a browser through the launch configuration, using an explicit executablePath or a supported browser channel. For example, with a known local Chrome path:
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Rank #3
- 256 GB SSD of storage.
- Multitasking is easy with 16GB of RAM
- Equipped with a blazing fast Core i5 2.00 GHz processor.
import puppeteer from 'puppeteer-core';
const browser = await puppeteer.launch({
executablePath: '/path/to/chrome'
});
Replace /path/to/chrome with the actual executable path on your machine. The location and browser version depend on your operating system and installation; this example does not assume a particular path. Puppeteer’s installation guide describes package choice and browser configuration.
Debug Puppeteer inside VS Code
You do not need to leave the editor to inspect browser-launch or navigation failures. VS Code’s Node.js debugging tools support breakpoints, the JavaScript Debug Terminal, auto attach and a launch.json configuration.
- Set a breakpoint in
screenshot.mjsby clicking beside a line number. - Press F5 to start debugging, or open the Run and Debug view and choose a Node.js configuration.
- For a script started from a shell, use the JavaScript Debug Terminal or enable auto attach so VS Code can attach to Node.js processes.
- Step through the code and inspect the line where launch, navigation, selector lookup or screenshot capture fails.
See Microsoft’s VS Code Node.js debugging guide for the debugger options and configuration details.
Troubleshoot common installation and capture failures
node or npm is not recognized
Node.js is missing or the terminal has not picked up the updated PATH. Install Node.js, close the current terminal, open a new VS Code window or terminal, and check node --version and npm --version again.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #4
- EFFORTLESS EVERYDAY PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 Home system, delivering reliable, low-power efficiency for daily tasks like document editing, email, online classes, and web browsing
- 15.6-INCH FULL HD DISPLAY: Enjoy immersive visuals on the 15.6" FHD (1920x1080) anti-glare screen with micro-edge bezels. Delivers clear details and comfortable viewing for long study sessions, working on spreadsheets, and video playback
- RESPONSIVE MULTITASKING & STORAGE: Built with 4GB LPDDR4 RAM and 128GB eMMC storage for smooth daily essential use. Expand your storage by up to 1TB via the integrated TF card slot to easily store movies, photos, and working files
- ADVANCED CONNECTIVITY: Outfitted with 2x Full-Featured Type-C ports for data transfer, fast charging, and dual-monitor output, alongside 2x USB 3.2 Gen1 ports and a 3.5mm audio jack for complete peripheral compatibility
- LIGHTWEIGHT & SILENT OPERATION: Slim and portable for effortless travel or commuting. Features a 1MP HD webcam for remote meetings, 38Wh battery with 45W Type-C fast charging, and a fanless silent design for peaceful work environments.
Could not find Chrome
The browser download may not have run, commonly because the package manager blocked install scripts. Run npx puppeteer browsers install. If the issue persists, allow Puppeteer’s install script and rerun the browser installation command. Check the terminal output for download errors and confirm the configured browser cache is writable.
You need a specific Chrome or Chromium executable
Use puppeteer-core or configure Puppeteer to use the browser you manage, supplying executablePath or a browser channel as appropriate. If you change download-related Puppeteer configuration, rerun the browser-install command so the installed browser matches the configuration.
The screenshot is blank or incomplete
- Confirm that navigation reached the expected URL and did not time out or redirect to an error page.
- Change the wait condition to match the site, or wait for a selector that appears only when the relevant content is ready.
- Use
fullPage: trueonly when the full document is required; otherwise, a viewport capture may better match the task. - For one component, wait for its selector and use an element screenshot rather than capturing the entire page.
The script exits before the screenshot is written
Look at the first error in the terminal, then debug the relevant step: browser launch, page.goto(), selector wait or screenshot. Keeping browser.close() in a finally block ensures the browser is closed on errors; it does not suppress the error or guarantee a screenshot was created.
Performance, reliability and operating costs
The first setup may take longer and use more disk because Puppeteer downloads its browser. On later runs, the installed browser can be reused from the cache, while each script still spends time launching a browser, loading the site and rendering the requested page. Full-page captures may also require more memory and produce larger files than viewport images. The download-size estimates above are approximate figures in Puppeteer’s documentation, not fixed requirements for every configuration.
Best Value
- WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
- 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
- 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
- CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
- LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.
For repeated automation, use the same installed browser configuration consistently and select a readiness condition that avoids waiting on activity unrelated to the screenshot. Account for site behavior: authentication, client-side rendering, bot checks, network access and changing page content can affect the result. A local VS Code setup gives you direct control over the script and browser, but it also means your machine must have the required runtime, browser and resources available whenever the job runs.
Or skip the browser setup
If you need an image or PDF from a URL without installing and maintaining a local browser, ScreenshotNeo is a website screenshot API and MCP server for developers. One GET request returns a PNG, JPEG, WebP or PDF. The following cURL example saves a WebP capture of the Stripe homepage; replace the URL and use your own API key:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. Cookie and consent banners are accepted like a visitor and removed, along with known newsletter popups and chat widgets, before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and the response includes X-Page-Verdict and X-Billed headers. An MCP server provides take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.
The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots, and every feature is on every plan. Sign up for 1,000 free screenshots a month—no card required.
Frequently Asked Questions
Does Puppeteer work directly in VS Code?
Yes. VS Code is where you edit and debug the Node.js script; run it from the integrated terminal or VS Code’s debugger.
Does puppeteer-core install Chrome?
No. It expects you to provide or manage a browser, such as through an executable path or browser channel.
Where does Puppeteer save a screenshot?
The path passed to page.screenshot() determines the output location. In the example, screenshot.png is written relative to the directory from which the script runs.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




