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

For a whole-page capture, set fullPage: true. Use clip for a rectangle, or call ElementHandle.screenshot() for a particular DOM element. Then choose the image type and where to send the result. The default format is PNG, and the quality option does not affect PNG output.

Capture a full page with Puppeteer

Page.screenshot() captures the page. Its fullPage option defaults to false; set it to true when the screenshot should cover the full page rather than just the visible viewport.

import puppeteer from 'puppeteer';

const browser = await puppeteer.launch();
try {
  const page = await browser.newPage();
  await page.goto('https://example.com', { waitUntil: 'networkidle0' });
  await page.screenshot({ path: 'full-page.png', fullPage: true });
} finally {
  await browser.close();
}

The example saves the result to a file. Change the URL and output filename for your use case. For pages that keep making network requests, choose a different navigation wait condition or an explicit selector/delay strategy rather than assuming the network will become idle.

Choose the capture area

Whole page

Set fullPage: true to request the full page. Leave it unset or set it to false when the viewport capture is what you want.

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

Rectangular region

Pass clip with the region’s coordinates and dimensions. A clip is a ScreenshotClip, which extends BoundingBox and accepts an optional scale; its default is 1.

await page.screenshot({
  path: 'region.png',
  clip: { x: 100, y: 200, width: 600, height: 400 }
});

Coordinates and dimensions are in the page’s screenshot coordinate space. If a clipped area extends beyond the current viewport, note the captureBeyondViewport default: it is false when there is no clip and true when a clip is present. Set it explicitly if you need to make the intended behavior clear or to override the default.

One DOM element

Use an element handle’s screenshot() method when the target is a specific DOM node rather than a coordinate rectangle. Puppeteer scrolls the element into view if needed and then captures it using page screenshot behavior.

Rank #2
Sale
HTML and CSS: Design and Build Websites
  • HTML CSS Design and Build Web Sites
  • Comes with secure packaging
  • It can be a gift option
const card = await page.$('.product-card');
if (!card) throw new Error('Product card not found');
await card.screenshot({ path: 'product-card.png' });

If the element is detached from the DOM before capture, Puppeteer throws an error. On pages that replace content dynamically, wait for the element to appear and, if it changes or disappears, reacquire the handle before taking the screenshot.

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

At a glance

Method or option What it captures Useful detail
fullPage: true The full page Defaults to false.
clip A coordinate-defined rectangle Optional scale defaults to 1.
ElementHandle.screenshot() A DOM element Scrolls it into view if necessary; errors if detached.

Choose image format and quality

Puppeteer documents PNG as the default screenshot type. You can specify another supported screenshot type, but the reviewed API documentation does not establish a universal winner for file size, visual fidelity, or capture speed. Choose based on what will consume the image, then test with your own pages if those trade-offs matter.

await page.screenshot({ path: 'capture.jpeg', type: 'jpeg', quality: 80 });

The documented quality range is 0–100. It applies to non-PNG formats; it does not apply to PNG, so changing quality will not make a PNG sharper or smaller. The file extension can inform the screenshot type when you provide path and omit type. For clarity in reusable code, specify both the path extension and type.

Set the background and output destination

Transparent background

Use omitBackground: true to hide the default white background and allow a transparent capture where the output format supports it.

await page.screenshot({
  path: 'logo.png',
  omitBackground: true
});

Save to disk or handle the result in code

Set path to write an image file. Without a path, Puppeteer does not write a file to disk. By default, Page.screenshot() returns a Uint8Array, which you can pass to other code or write yourself. Setting base64 encoding returns a string instead.

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.
const bytes = await page.screenshot(); // Uint8Array
const base64 = await page.screenshot({ encoding: 'base64' }); // string

Keep captures reliable in automation

  • Wait for the page state you actually need before capture; navigation completion alone does not guarantee that a particular dynamic component is ready.
  • For element screenshots, wait for the target and reacquire its handle if the page may replace the node.
  • Avoid changing tabs or page state during a screenshot operation. Puppeteer documents that some page and browser-context operations wait for screenshots to finish, while bringToFront() does not wait for existing screenshot operations.
  • Check the documentation matching your installed Puppeteer version when behavior differs. The current API reference identifies version 25.12.0; the ScreenshotClip reference identifies version 25.10.0.

The official changelog records historical screenshot behavior changes, including clipping and capture beyond the viewport. For current defaults, use the API reference for your installed version rather than relying on old behavior notes.

Rank #4
Sale
Web Design with HTML, CSS, JavaScript and jQuery Set
  • Brand: Wiley
  • Set of 2 Volumes
  • A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers

Troubleshoot common screenshot problems

The screenshot only shows the viewport

Set fullPage: true. The option defaults to false.

The clip misses content outside the viewport

Check the clip’s x, y, width, and height, then set captureBeyondViewport explicitly if your desired region crosses the viewport boundary. Its documented default depends on whether a clip is present.

Changing quality has no effect

Confirm the output type. quality does not apply to PNG.

No file appears

Pass a path if you expect Puppeteer to save the image. Without it, handle the returned Uint8Array or base64 string in your program.

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

Element capture fails

Make sure the selector matched an element and that the element is still attached when you call screenshot(). Wait for the element and reacquire it after dynamic page updates.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need a screenshot without managing Puppeteer and a browser, ScreenshotNeo takes one GET request with a URL and returns a PNG, JPEG, WebP, or PDF. For example, this cURL request saves a WebP screenshot:

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 the request options. Cookie banners and consent overlays are accepted or removed before capture, along with supported newsletter popups and chat widgets. Bot checks, blank pages, and failed loads are never billed; response headers indicate the page verdict and billing status. An MCP server provides screenshot tools for AI agents, and the free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000.

Sign up for ScreenshotNeo’s free plan.

Version note

Puppeteer’s API evolves. The cited current ScreenshotOptions reference identifies itself as version 25.12.0, while the ScreenshotClip reference is version 25.10.0. Check the API reference for the version installed in your project if an option or default does not match your results.

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.

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.