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.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

To capture an entire webpage in Node.js, use Playwright or Puppeteer and set fullPage: true in the screenshot options. Both libraries save the image to a file or return image data. The key is to wait for the page’s meaningful content—not merely navigation—to be ready before capturing it.

Choose Playwright or Puppeteer

Both browser automation libraries support full-page screenshots. The central option is identical: fullPage: true. It is false by default in the cited API references, so specify it explicitly.

Need Playwright Puppeteer
Full-page capture fullPage: true fullPage: true
Save to a file Pass a path to page.screenshot(). Pass a path to page.screenshot().
Use screenshot data in code Capture into a buffer. By default, the result is a Uint8Array; request base64 encoding for a base64 string.
Additional capture controls The API documents image type, scale, masking, animation handling, and transparent background options. The API documents image type and quality-related options.

Pick the library your project already uses where possible. If you are choosing from scratch, consider whether you need Playwright’s documented masking and animation options, or Puppeteer’s existing fit with your project. Both support other capture forms, including viewport, clip, or element-oriented workflows; check the API for the exact options you need. Playwright screenshots guide · Playwright screenshot API · Puppeteer screenshot API

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

Capture a full page with Playwright

The essential call is await page.screenshot({ path: 'full.png', fullPage: true }). The following example navigates to a page, takes a full-page PNG, and closes the browser even if navigation or capture fails:

const { chromium } = require('playwright');

async function main() {
  const browser = await chromium.launch();
  try {
    const page = await browser.newPage();
    await page.goto('https://example.com', { waitUntil: 'load' });

    await page.screenshot({
      path: 'full.png',
      fullPage: true,
      type: 'png'
    });
  } finally {
    await browser.close();
  }
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

Replace https://example.com with the target URL. This writes full.png in the process’s working directory. Playwright documents both saving to a path and capturing screenshot data into a buffer; omit path when you want the returned data instead. See the Playwright screenshots guide and screenshot API reference for the available options.

Return bytes instead of writing a file

Use the returned buffer as input to a later step, such as an upload or an application-specific storage function:

const image = await page.screenshot({ fullPage: true, type: 'png' });
// image contains screenshot data; pass it to your storage or upload code.

Use this inside the same browser-and-page flow as the file example. The comment is intentionally generic: storage APIs differ, and the screenshot call alone does not upload the image.

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

Capture a full page with Puppeteer

Puppeteer uses the same option. Its guide demonstrates launching a browser, opening a page, and navigating to a URL; a networkidle2 navigation wait appears in its example, but it is not a universal signal that every site’s content is ready.

const puppeteer = require('puppeteer');

async function main() {
  const browser = await puppeteer.launch();
  try {
    const page = await browser.newPage();
    await page.goto('https://example.com', { waitUntil: 'networkidle2' });

    await page.screenshot({
      path: 'full.png',
      fullPage: true,
      type: 'png'
    });
  } finally {
    await browser.close();
  }
}

main().catch((error) => {
  console.error(error);
  process.exitCode = 1;
});

By default, Puppeteer’s screenshot call returns a Uint8Array when no path is supplied. Its API also documents a base64 result when base64 encoding is requested. Consult the Puppeteer screenshots guide and screenshot API reference for the precise options supported by your installed version.

Make sure the page is ready before capture

A full-page option expands the capture beyond the visible viewport; it does not tell you whether an application has finished rendering its useful content. A page may still be loading data, rendering components, or fetching images after the browser’s navigation wait has completed. Choose readiness checks based on the site you are capturing.

  • Wait for a meaningful element: If the page has a stable selector that appears when the main content is ready, wait for that selector before taking the screenshot.
  • Account for delayed updates: A fixed delay can help with known timed rendering, but it is a guess and can waste time or still be too short.
  • Consider lazy-loaded images: Images may load only as the page is scrolled. A full-page screenshot is not, by itself, proof that every lazy image has been fetched and displayed.
  • Do not treat network idle as a guarantee: Puppeteer’s guide shows networkidle2 as an example navigation wait. Sites with persistent network activity or later client-side rendering may need a different readiness check.

There is no single wait condition established here as correct for every site. For repeatable captures, define what “ready” means for the page you own or the content you depend on, then test that condition against the target.

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

Understand what “full page” captures

Playwright describes a full-page screenshot as capturing a full scrollable page “as if you had a very tall screen and the page could fit it entirely.” In practical terms, set fullPage: true when you want more than the current viewport. If you need only a section, a particular element, or a rectangle, use the library’s corresponding capture option rather than treating a full-document image as a crop.

Image format and output handling are separate choices from page extent. Playwright documents a type and scale option; Puppeteer documents image type and quality-related options. Check the relevant API for supported formats and details, especially if you need a particular output type or resolution.

Or skip the browser setup

If you would rather call a screenshot service than manage a browser in your Node.js process, ScreenshotNeo takes a webpage URL in one GET request and returns an image or PDF. This Node.js example saves the response body to a WebP file:

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

This is the request example; add your application’s response handling and file-writing code if you need to persist the returned bytes. See the ScreenshotNeo API documentation for request options and response details.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Cookie banners are accepted and removed before capture; known consent platforms, newsletter popups, and chat widgets can also be removed, with each step switchable.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing; the response includes X-Page-Verdict and X-Billed headers.
  • An MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and MCP clients.
  • The Free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Every feature is available on every plan.

Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month without a card.

Troubleshoot common capture problems

The output shows only the visible viewport

Confirm that the call includes fullPage: true. Both APIs document this option as false by default, so omitting it produces the default capture rather than explicitly requesting the whole scrollable page.

The screenshot misses content that appears later

The page may have continued rendering after navigation completed, or images may be lazy-loaded. Wait for a page-specific content selector or otherwise establish a readiness condition appropriate to that site before capturing. A navigation wait alone does not establish that every dynamic element is complete.

The page looks blank or incomplete

Check that navigation reached the intended URL and that the application’s main content appeared before calling screenshot(). If the page depends on client-side data, make your wait target a real content element rather than relying only on a generic navigation event.

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

The script exits with an error or leaves a browser process running

Log the error from navigation or capture, and close the browser in a finally block as shown above. This ensures your cleanup path runs whether the screenshot succeeds or an earlier step throws.

The file is not where you expected

A relative screenshot path is resolved from the Node.js process’s working directory. Use an explicit destination path if your application expects the output in a particular folder, and ensure that the process can write there.

The image type or output representation is wrong for the next step

Specify an image type supported by the selected library’s current API. For a file, provide a path; for application code that consumes image data, omit the path and handle the returned buffer or byte array. Puppeteer also documents a base64 return when requested. Verify exact option names and types against the API reference for the version in your project.

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

Performance, reliability, and cost considerations

These examples run a browser and capture a full document, so they are useful when you need browser-level control in your own Node.js workflow. The cited documentation does not establish universal maximum page dimensions, memory requirements, runtime, or compatibility across Node.js and browser versions. Those depend on your actual package version, runtime, environment, and target page; test representative pages in the deployment environment rather than assuming a fixed limit.

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

For a repeatable job, close the browser after each run or manage its lifecycle deliberately, use a page-specific readiness condition, and decide whether the next stage needs a file or in-memory bytes. Full-page capture can produce a substantially taller image than a viewport screenshot, so consider the downstream storage or processing needs before keeping large outputs in memory.

Playwright and Puppeteer are browser automation libraries; this article’s sources do not establish their package costs, hosting costs, or a comparative performance winner. If operating a browser is not a fit, a hosted screenshot API is an alternative; compare its billing and failure behavior against your needs rather than assuming that every requested URL produces a billable image.

Frequently Asked Questions

Does fullPage: true scroll through the page before taking the screenshot?

The documented result is a capture of the full scrollable page, as if displayed on a very tall screen. The API descriptions do not require you to manually scroll the page first.

Can I capture just one element instead of the whole page?

Yes. Both libraries provide capture forms beyond full-page screenshots, including element-oriented or clipped captures. Use the option documented for the library and version in your project.

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

Can I return screenshot data without creating a file?

Yes. Omit the path and consume the returned data: Playwright supports buffer capture, while Puppeteer returns a Uint8Array by default and documents base64 output when requested.

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.