Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use Puppeteer’s headless browser, navigate to a page, and call page.screenshot(). Puppeteer launches in regular headless mode by default, so this minimal script saves a PNG without opening a visible Chrome window:

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.goto('https://example.com');
  await page.screenshot({ path: 'screenshot.png' });
} finally {
  await browser.close();
}

The rest of this guide shows viewport, full-page, element, clipped, transparent and in-memory captures; explains headless modes, sizing and reliability; and provides fixes for common failures. The examples follow Puppeteer documentation reviewed at version 25.12.0, which is the version label shown in those pages at that time.

Set up Puppeteer

Install Puppeteer in a Node.js project. The package downloads a compatible bundled browser during installation.

npm init -y
npm install puppeteer

Use an ES-module file such as screenshot.mjs, or set "type": "module" in package.json. Puppeteer is guaranteed to work with its bundled browser; using another executable is at your own risk (LaunchOptions).

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents

Take a basic headless screenshot

  1. Import Puppeteer.
  2. Launch with puppeteer.launch(). The default is headless mode (headless: true).
  3. Create a page and navigate with page.goto().
  4. Call page.screenshot(), supplying a file path.
  5. Close the browser in a finally block so failed navigations do not leave Chrome processes running.
import puppeteer from 'puppeteer';

const url = 'https://example.com';
const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.goto(url, { waitUntil: 'networkidle2' });
  await page.screenshot({ path: 'screenshot.png' });
  console.log('Saved screenshot.png');
} finally {
  await browser.close();
}

path is resolved relative to the process’s current working directory. Without path, Puppeteer returns image bytes instead of writing a file (Page.screenshot(); ScreenshotOptions).

Choose the capture area

Viewport only

fullPage defaults to false, so this captures the currently visible viewport:

await page.screenshot({ path: 'viewport.png' });

Entire document

Set fullPage: true to capture the page’s full scrollable content:

await page.screenshot({
  path: 'full-page.png',
  fullPage: true
});

Full-page mode changes the capture extent; it is not automatically preferable to a viewport or a specific region. Long, dynamically rendered pages may need an explicit wait for content before capture.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A rectangular region

Use clip with CSS-pixel coordinates to capture a rectangle. The rectangle needs x, y, width and height:

await page.screenshot({
  path: 'region.png',
  clip: { x: 40, y: 120, width: 640, height: 360 }
});

One element

Find the element, then call its handle’s screenshot() method. Puppeteer scrolls the element into view when necessary. The call throws if the element has been detached from the DOM (ElementHandle.screenshot()).

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
const element = await page.waitForSelector('main');
if (!element) throw new Error('main was not found');
await element.screenshot({ path: 'main.png' });

For modern pages that replace nodes during rendering, locate the selector immediately before capture and avoid retaining a handle across a re-render.

Transparent output

omitBackground: true hides the default white background and allows transparency, useful for isolated UI components:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
await page.screenshot({
  path: 'transparent.png',
  omitBackground: true
});

Control format, quality and returned data

Option Use
path Writes the image to a file. Relative paths use the current working directory.
type Choose the image format supported by Puppeteer, such as PNG, JPEG or WebP where available.
quality Set a 0–100 quality value for lossy formats. It does not apply to PNG.
fullPage Capture the complete page rather than only the viewport.
clip Capture a specified rectangle.
omitBackground Permit transparent pixels instead of a white page background.

When no path is supplied, the method returns a buffer. That is useful for HTTP responses, object storage or image processing:

const image = await page.screenshot({ type: 'png' });
// image is a Buffer; send it to your API or storage layer

Wait for the page you actually want to capture

page.goto() resolves according to its wait condition, but a successful navigation does not guarantee that framework-rendered content, fonts or lazy images are ready. Pick a condition that matches the page:

  • waitUntil: 'domcontentloaded' waits for the initial HTML to be parsed.
  • waitUntil: 'load' waits for the load event.
  • waitUntil: 'networkidle2' waits until network activity is low; analytics or streaming connections can prevent a useful idle point.
await page.goto('https://example.com/dashboard', {
  waitUntil: 'networkidle2',
  timeout: 60000
});
await page.waitForSelector('[data-ready="true"]', { timeout: 30000 });
await page.screenshot({ path: 'dashboard.png', fullPage: true });

For a known animation or delayed widget, a short explicit delay can be clearer than assuming network idle:

await new Promise(resolve => setTimeout(resolve, 1000));

Use delays sparingly; a readiness selector is generally more deterministic.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Set viewport and screen size deliberately

Set the page viewport before navigation when screenshot dimensions matter:

await page.setViewportSize({ width: 1440, height: 900 });

If neither --screen-info nor --window-size is supplied, Puppeteer documents an 800×600 headless screen configuration. That is a screen default, not a promise that every screenshot is 800×600: page screenshot options, device scale and full-page capture determine the output (Screen configuration).

For repeatable visual comparisons, record the Puppeteer version, browser binary or channel, headless setting, viewport, device scale factor and screenshot options. Differences in any of these can change layout, fonts or anti-aliasing.

Regular headless Chrome versus headless shell

The current guide distinguishes regular/new headless Chrome from chrome-headless-shell, an older headless mode shipped as a separate binary (Headless mode).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Launch value Behavior Choose it when
true (default) Regular headless Chrome with the broadest Chrome feature compatibility. Your screenshots should match normal Chrome behavior.
'shell' Uses chrome-headless-shell; the guide notes it does not completely match regular Chrome but can be more performant for automation that does not need the complete feature set. You have verified the page works with the shell and performance is the priority.
false Shows a visible browser window. You need to watch the page while debugging.
const browser = await puppeteer.launch({ headless: 'shell' });

Do not assume shell and regular headless output are identical. Test the mode against the exact browser features and rendering fidelity your workflow requires.

Reliable capture patterns

Handle navigation failures

try {
  await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 60000 });
} catch (error) {
  console.error(`Navigation failed for ${url}:`, error);
  throw error;
}

A timeout can still leave a partially loaded document. Capture it only if that partial state is an intentional fallback.

Rank #4
Sale
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient

Wait for lazy content

Full-page capture does not guarantee that every lazy image has loaded. Scroll or wait for an application-provided ready marker before taking the image:

await page.evaluate(async () => {
  document.querySelectorAll('img[loading="lazy"]').forEach(img => img.scrollIntoView());
});
await page.waitForFunction(() =>
  [...document.images].every(img => img.complete)
);
await page.screenshot({ path: 'all-images.png', fullPage: true });

Prevent resource leaks

Always close the browser in finally. In a service processing many URLs, reuse a browser process carefully, create and close pages per job, and impose navigation and job timeouts so one site cannot occupy a worker indefinitely.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Make output reproducible

  • Pin the Puppeteer version in your lockfile.
  • Use a fixed viewport and device scale factor.
  • Use the same bundled browser or explicitly record any channel choice.
  • Set locale, timezone and authentication state when they affect layout.
  • Wait for a semantic readiness signal rather than a guessed delay.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common errors and fixes

“Could not find Chrome” or browser launch failure

Run the package installation again so Puppeteer’s bundled browser is present, and verify that the runtime can execute it. If you intentionally set executablePath, confirm the path and accept that non-bundled browsers are not guaranteed.

Screenshot is blank or shows a loading shell

Wait for the application’s content selector, increase the navigation timeout, and check console or page errors. A successful HTTP response can still represent a client-side failure.

Element screenshot says the element is detached

The page replaced the node between lookup and capture. Call waitForSelector again immediately before element.screenshot(), or wait for the framework’s render-complete marker.

Images are missing

Wait for image completion, scroll lazy images into view, and check that the headless browser can reach the image host. Authenticated or signed image URLs may require cookies or headers configured before navigation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

Output size is unexpected

Check whether you requested fullPage, inspect the viewport set with setViewportSize, and distinguish CSS pixels from device-scaled output. Do not infer dimensions from the documented 800×600 screen default alone.

Headless differs from visible Chrome

Confirm the launch mode, browser version and viewport. If you selected headless: 'shell', switch to regular headless mode and compare; Puppeteer explicitly warns that shell behavior does not completely match regular Chrome.

Or skip the browser setup

ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP or PDF, while its capture flow accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets before the shot. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed; response headers identify the page verdict and whether it was billed. Its MCP tools—take_screenshot, get_page_info and capture_pdf—let Claude, Cursor and other MCP clients capture pages without maintaining a browser.

Here is the one-call cURL version (see the ScreenshotNeo documentation for all options):

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

The same request in Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

And Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo includes full-page and CSS-selector captures, dark mode, device presets or custom viewports, retina scale, PDF controls, custom CSS and JavaScript, click and wait actions, request blocking, headers, cookies, user agents, authorization, timezone and geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous webhooks, bulk capture for up to 100 URLs per call, usage reporting and an OpenAPI specification. Parameter names used by other screenshot APIs also work, which can simplify migration.

Plan Included shots Price
Free 1,000 per month No card required
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Yearly billing gives two months free, and every feature is available on every plan. Create a free ScreenshotNeo account to start with 1,000 screenshots a month without a card.

FAQ

Does Puppeteer require headless: true?

No. puppeteer.launch() already defaults to regular headless mode. Specify the option only when documenting intent or selecting 'shell' or false.

Can I return screenshot bytes instead of a file?

Yes. Omit path; page.screenshot() returns image bytes that your application can stream or store.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What is the safest way to capture a changing element?

Wait for the selector immediately before capture and ensure the application has finished replacing its DOM node; detached handles cannot be screenshotted.

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.