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

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

For a batch of hundreds of URLs, launch Puppeteer once, then process the URLs with a small, configurable pool of pages. Give every capture a unique output path, use a readiness condition that fits the site, log failures per URL, and close each page even when a capture fails. This avoids the overhead and fragility of treating every screenshot as an unrelated browser run—without assuming there is one universally safe concurrency setting.

Build a batch pipeline, not a loop of browser launches

Puppeteer’s official guidance is direct: “For capturing screenshots use Page.screenshot().” A one-off capture needs a browser, a page, navigation, a screenshot, and cleanup. For hundreds of captures, retain that basic flow but reuse the browser and manage pages as bounded jobs.

The pattern below uses one browser, a configurable number of workers, and one page per active URL. Workers claim the next URL only when they finish their current job. Each job gets a deterministic, unique filename, and a failed URL is recorded without aborting the rest of the batch.

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

Install Puppeteer and prepare a URL list

In a new Node.js project, install Puppeteer:

npm install puppeteer

Save the following as batch-screenshots.js. Replace the sample URLs with your own list. It writes screenshots into a screenshots directory alongside the script.

#1 Best Overall
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

Runnable bounded-worker example

const fs = require('node:fs/promises');
const path = require('node:path');
const puppeteer = require('puppeteer');

const urls = [
  'https://example.com/',
  'https://www.wikipedia.org/',
  'https://nodejs.org/',
];

const outputDir = path.join(__dirname, 'screenshots');
const workerCount = Number(process.env.WORKERS || 3);
const viewport = { width: 1440, height: 900, deviceScaleFactor: 1 };
const failures = [];
let nextIndex = 0;

function filenameFor(url, index) {
  const host = new URL(url).hostname.replace(/[^a-z0-9.-]/gi, '_');
  return `${String(index + 1).padStart(4, '0')}-${host}.png`;
}

async function captureOne(browser, url, index) {
  const page = await browser.newPage();
  const outputPath = path.join(outputDir, filenameFor(url, index));
  try {
    await page.setViewport(viewport);
    // Choose a site-appropriate readiness condition; see the section below.
    await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 45000 });
    await page.screenshot({ path: outputPath, fullPage: true });
    console.log(`OK ${url} -> ${outputPath}`);
  } finally {
    await page.close();
  }
}

async function worker(browser) {
  while (true) {
    const index = nextIndex++;
    if (index >= urls.length) return;
    const url = urls[index];
    try {
      await captureOne(browser, url, index);
    } catch (error) {
      failures.push({ url, error: String(error) });
      console.error(`FAILED ${url}: ${error.message}`);
    }
  }
}

(async () => {
  await fs.mkdir(outputDir, { recursive: true });
  const browser = await puppeteer.launch({ headless: true });
  try {
    const count = Math.max(1, Math.min(workerCount, urls.length));
    await Promise.all(Array.from({ length: count }, () => worker(browser)));
  } finally {
    await browser.close();
  }
  await fs.writeFile(
    path.join(outputDir, 'failures.json'),
    JSON.stringify(failures, null, 2)
  );
  console.log(`Finished ${urls.length} URLs; ${failures.length} failed.`);
  if (failures.length) process.exitCode = 1;
})();

Run it with the default three workers or set a different limit:

node batch-screenshots.js
WORKERS=2 node batch-screenshots.js

The worker count is an engineering starting point, not a Puppeteer guarantee. Documentation does not specify a safe concurrency level or throughput for hundreds of captures. Measure completion time and memory on your pages and machine, and lower the limit if the browser or host becomes unstable.

Choose navigation readiness for the pages you capture

A screenshot taken too early may miss client-rendered content; waiting for every network connection to stop can stall on pages with analytics, polling, or long-lived requests. Puppeteer’s guide uses networkidle2 in its example, but that does not make it the right condition for every site.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • domcontentloaded is a reasonable start when the screenshot needs the initial document and assets can continue loading. Add an explicit selector wait when important content renders later.
  • load waits for the page’s load event and its dependent resources, which may be slower for asset-heavy pages.
  • networkidle2 can suit pages that settle after a short burst of requests, but may be unsuitable for applications with persistent traffic.
  • page.waitForSelector('.report-ready') or a site-specific function is often more reliable when the desired content has a known ready state.

For a known selector, change the navigation portion of the example to:

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
await page.goto(url, { waitUntil: 'domcontentloaded', timeout: 45000 });
await page.waitForSelector('.report-ready', { timeout: 15000 });

Use selectors that indicate the actual content is ready, not merely that the page shell exists. If the page is slow or intermittently unavailable, distinguish a navigation timeout from a selector timeout in your failure log so you know which recovery is appropriate.

Set dimensions and select the capture area

Set the viewport before navigation when the target’s responsive layout matters. Puppeteer’s Page reference notes that many websites do not expect phones to change size; pages in a single browser can have different viewport sizes. For repeatable comparisons, use the same viewport and device scale for every URL.

The example uses fullPage: true to capture the page beyond the visible viewport. Set it to false to capture only the viewport. Full-page images can have very different dimensions depending on each page’s length, so they may consume more storage and take longer to inspect or transfer. For a region, use the documented clip option instead of capturing the entire page.

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

To capture an element rather than the page, locate it and call ElementHandle.screenshot():

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.
const element = await page.waitForSelector('.invoice-total', { timeout: 15000 });
if (!element) throw new Error('Target element was not found');
await element.screenshot({ path: outputPath });

Choose output format and image quality

Page.screenshot() can write to a file path or return image bytes. PNG is the documented default. Set type to 'jpeg' or 'webp' when smaller files matter more than lossless output, and choose an appropriate quality after validating the results. The quality option applies to non-PNG formats, not PNG.

await page.screenshot({ path: outputPath, type: 'jpeg', quality: 82, fullPage: true });

Use PNG when sharp text, UI edges, or exact pixel fidelity matter. JPEG or WebP can reduce output size, but lossy compression can alter fine text and interface details. Compare representative captures before changing format across a large batch. Puppeteer also exposes optimizeForSpeed, which defaults to false; the documentation provides no benchmark establishing a speed improvement, so treat it as an option to evaluate rather than a guaranteed optimization.

Use pages or contexts depending on session isolation

Multiple Page instances can belong to one Browser, which makes pages a practical unit of parallel work. In the sample, each active job gets its own page. Pages in the same default browser context share that context’s session state, including cookies and local storage.

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.

When URLs must not share state—for example, jobs representing different test users—use a separate BrowserContext per isolated job or group of jobs. Contexts isolate browser storage, but they also consume resources. Close a non-default context when its work is done; closing it closes its pages. Benchmark the page-versus-context arrangement on your actual workload rather than assuming either has a fixed memory cost.

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

Make filenames, retries, and failures safe

A batch is only useful if its output can be matched to its input and a single broken page does not erase the results. The sample prefixes each filename with the URL’s position and hostname, and writes failures to JSON. If the same hostname can appear more than once in the input, the index keeps names unique. For repeatable runs, consider writing each run into its own timestamped directory rather than overwriting prior output.

Retries are an implementation choice, not a Puppeteer requirement. If you add them, retry only failures that may be transient, such as a navigation timeout or temporary connection error; a missing selector may indicate a changed page and should not be retried indefinitely. Limit retries, log each attempt, and preserve the final failure alongside successful captures. Do not mark a URL successful until the screenshot write completes.

Also account for destinations that redirect, return an error page, or require authentication. If authentication is needed, explicitly establish the required cookies or headers before capture, and avoid placing secrets in filenames or logs. Ensure output directories have enough space for full-page images and that downstream processing can handle variable image dimensions.

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

Tune throughput without guessing

A larger worker pool can shorten elapsed time when jobs are waiting on navigation, but each active page also consumes browser and machine resources. More concurrency can therefore increase memory pressure or make captures less reliable. Puppeteer’s docs do not prescribe a safe number of concurrent screenshot jobs, nor a universal pages-per-browser or screenshots-per-second figure.

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.
  1. Start with a modest worker limit, such as the example’s three, and record total duration, memory use, and failures for a representative URL set.
  2. Increase the limit gradually only while resource use and output quality remain acceptable.
  3. Repeat using the real viewport, readiness checks, page lengths, and output formats; lightweight sample pages may not represent production pages.
  4. Keep the best stable setting for the machine and workload, and make it configurable so it can be adjusted when either changes.

Browser reuse avoids repeatedly launching a browser for every URL, while a worker pool prevents an unbounded number of pages from being created at once. Those are sound batch-design practices, not a documented speedup guarantee. Measure the total batch rather than optimizing a single screenshot in isolation.

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

Handle capture lifecycle and browser errors

Use try/finally around each page so the page closes after success or failure, then close the browser after all workers settle. Puppeteer’s screenshot API notes that during a screenshot capture in a BrowserContext, operations including BrowserContext.newPage(), Browser.newPage(), and Page.close() wait for the capture to finish; Page.bringToFront() does not. This matters if your orchestration tries to create or close pages while captures are still running: avoid treating those operations as instantaneous.

If the browser process exits unexpectedly, preserve the per-URL failure list and restart the batch from failed entries rather than redoing every successful capture. For important workflows, write a manifest containing URL, output path, status, and error, then update it after each job so a process interruption does not lose all progress.

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.

Troubleshooting common batch problems

  • Pages appear before content is ready: replace a generic navigation event with a selector or app-specific ready condition; verify the selector is present on every target variant.
  • Some navigations time out: identify whether the page is slow, blocked, or waiting on persistent network activity. Use a condition appropriate to the site, set a finite timeout, and log the URL and error type.
  • Browser crashes or the machine runs out of memory: reduce the worker limit, avoid unnecessary contexts, and check whether full-page outputs are unusually large. Retest incrementally on the actual host.
  • Files overwrite one another: include a stable index or unique identifier in every output name; hostname alone is not unique when the input list contains repeated domains.
  • Mobile layout is inconsistent: set the viewport before navigation and keep its dimensions and device scale consistent across jobs.
  • JPEG or WebP output looks poor: raise quality or use PNG for text and fine edges; remember quality does not apply to PNG.
  • One bad URL stops the whole batch: catch errors per job, close the page in finally, and continue collecting results in a failure manifest.

Or skip the browser setup

If you want screenshots from a URL without managing a local browser pool, ScreenshotNeo provides a screenshot API and MCP server. Its one-request capture can return PNG, JPEG, WebP, or PDF. For example, save a WebP shot of a target URL with cURL:

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 and setup. Cookie and consent banners are accepted like a visitor and removed, along with known newsletter popups and chat widgets, before capture; those steps can be turned off. Bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents using Claude, Cursor, or another MCP client take screenshots. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000.

Sign up free for 1,000 screenshots a month, with no card required.

References

Frequently Asked Questions

Can Puppeteer capture an element instead of the whole page?

Yes. Use the element handle’s screenshot() method to save a screenshot of that element.

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

Does Puppeteer document a maximum number of pages for one browser?

The cited Puppeteer references do not establish a universal safe page or concurrency limit; determine a stable limit by measuring the workload and host you plan to use.

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.