DriversRecommendedOutdated drivers can make a good PC feel brokenScan driver issues before chasing fixes manually.Scan NowOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk4 min

How to Capture a Full-Page Screenshot Using Puppeteer in Node.js

Use Puppeteer’s page.screenshot({ fullPage: true }) to capture a full-page image in Node.js, with examples for saving a file or using returned image data.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set fullPage: true in Puppeteer’s page.screenshot() call. Add a path to save the image to disk. The key part is await page.screenshot({ path: 'page.png', fullPage: true });.

Capture and save the full page

Install Puppeteer in your Node.js project, then launch a browser, open a page, navigate to the target URL, and take the screenshot. This ES module example writes a PNG and closes the browser even if navigation or capture fails:

As an Amazon Associate I earn from qualifying purchases.

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: 'page.png', fullPage: true });
} finally {
  await browser.close();
}

The Puppeteer screenshot guide demonstrates this launch, navigate, capture, and close workflow. fullPage is an optional boolean; it defaults to false, so set it to true when you want the full page rather than the viewport. The screenshot type is inferred from the filename extension, and PNG is the documented default type. See the Puppeteer screenshot guide and ScreenshotOptions API reference.

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.

Wait for the page content you need

page.goto() waits according to its navigation setting. The guide’s example uses waitUntil: 'networkidle2', but that is an example rather than a guarantee that every site is ready for capture. Pages may render content asynchronously or load sections as the user scrolls. If the page has a known readiness signal, wait for it before taking the screenshot:

await page.goto('https://example.com');
await page.waitForSelector('#main-content');
await page.screenshot({ path: 'page.png', fullPage: true });

Replace #main-content with a selector that indicates the content you need has appeared. Puppeteer’s full-page setting does not itself guarantee that lazy-loaded or infinite-scroll content has been fetched.

Choose a file or in-memory image data

Provide path when the image should be saved to disk. Without a path, Puppeteer does not write a file; the screenshot call returns image data. The API supports returned Uint8Array bytes, or a base64 string when using the encoding: 'base64' overload. Consult the Page.screenshot API reference for the return types.

const imageBytes = await page.screenshot({ fullPage: true });
// imageBytes is suitable for passing to code that consumes image bytes.

Use a filename extension that matches the desired output. Puppeteer documents PNG as the default; the screenshot options also support JPEG and WebP types. JPEG/WebP quality can be set from 0 to 100, but quality does not apply to PNG.

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

Useful screenshot options

  • fullPage: true captures the full page; its default is false.
  • path writes the image to a file. If omitted, the image is not saved to disk.
  • type selects the screenshot format; otherwise, the type is inferred from path, with PNG documented as the default.
  • quality sets JPEG or WebP quality from 0 to 100; it does not apply to PNG.
  • clip limits capture to a specified region. captureBeyondViewport is documented as defaulting to false when there is no clip and true otherwise.
  • Other documented options include encoding, fromSurface, omitBackground, and optimizeForSpeed. Check the API reference for their accepted values and behavior before relying on them.

Capture one element instead of the whole page

For a single element, use an element handle’s screenshot() method rather than page.screenshot({ fullPage: true }). Puppeteer scrolls the element into view if needed; capture throws if the element has been detached from the DOM.

const element = await page.waitForSelector('.receipt');
if (!element) throw new Error('Receipt element was not found');
await element.screenshot({ path: 'receipt.png' });

See the ElementHandle.screenshot API reference.

Browser cleanup and concurrent captures

Close the browser when the capture is finished so the browser process does not remain open. The try/finally pattern in the example ensures cleanup on errors as well as successful captures.

Puppeteer documents that, during a screenshot operation in a BrowserContext, calls such as newPage() and close() wait for the screenshot to finish. bringToFront() does not wait. This matters when coordinating concurrent browser work; see the Page API reference.

Troubleshooting

  • The image shows only the viewport: Set fullPage: true; the option defaults to false.
  • No image file appears: Supply a path, such as page.png. Without it, consume the returned image data instead.
  • The screenshot is missing content: Wait for the relevant selector or application readiness condition before capture. A navigation wait mode is not a universal signal that every dynamic section is ready.
  • An element screenshot throws: The element may have been detached from the DOM. Find it again after the page updates, then capture the current handle.
  • PNG quality settings seem ineffective: The documented quality option does not apply to PNG; choose JPEG or WebP if you need that setting.

Or skip the browser setup

ScreenshotNeo is a website screenshot API: send one GET request with a URL to get an image or PDF, without launching Puppeteer yourself. For example, this cURL command saves a WebP screenshot of example.com:

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://example.com -o shot.webp

See the ScreenshotNeo API documentation for setup and options. It accepts cookie and consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks, blank pages, failed loads, timeouts, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server provides screenshot tools for AI agents, including Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.

Sign up for ScreenshotNeo’s free plan.

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

Frequently Asked Questions

Which Puppeteer version do the cited API pages document?

The reviewed Puppeteer documentation showed version 25.12.0.

Can I capture an element that is outside the current viewport?

Yes. ElementHandle.screenshot() scrolls the element into view if needed before capturing it.

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.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

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.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.