Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk6 min

How to Batch Convert Website URLs to PNG Images with Playwright

A practical Playwright batch script for converting website URLs into PNG files, with guidance on page readiness, output paths, failures, and repeatable captures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a Node.js script that opens each URL in Playwright, waits for the page condition you choose, and saves a PNG to a unique path. Start with a sequential loop for predictable results; add limited parallel workers only when you have measured a need and can handle the extra load. The example below captures full pages and records HTTP status or per-URL errors.

Set up a Playwright batch

Install Playwright in a Node.js project and install its Chromium browser. Create an input list of fully qualified URLs (including https://) and ensure the destination directory exists. The script below uses one browser context and opens a new page for each URL in turn. Its numbered filenames avoid collisions even when different URLs have the same hostname or path.

As an Amazon Associate I earn from qualifying purchases.

Save this as an ES module, for example batch-screenshots.mjs, in a project where playwright is installed. Create a screenshots directory beside it before running.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Install the package: npm install playwright.
  2. Install Chromium: npx playwright install chromium.
  3. Create the output directory: mkdir -p screenshots (on Windows Command Prompt, use mkdir screenshots).
  4. Save and run the script: node batch-screenshots.mjs.
import { chromium } from 'playwright';

const urls = [
  'https://example.com',
  'https://playwright.dev',
];

const browser = await chromium.launch();
const context = await browser.newContext({
  viewport: { width: 1440, height: 900 },
});

try {
  for (const [index, url] of urls.entries()) {
    const page = await context.newPage();
    const path = `screenshots/${String(index + 1).padStart(3, '0')}.png`;

    try {
      const response = await page.goto(url, { waitUntil: 'load', timeout: 30_000 });
      const status = response?.status() ?? 'no response';
      await page.screenshot({ path, type: 'png', fullPage: true });
      console.log({ url, status, path });
    } catch (error) {
      console.error({ url, error: error.message });
    } finally {
      await page.close();
    }
  }
} finally {
  await context.close();
  await browser.close();
}

The script catches errors per URL, so a failed navigation or capture does not stop later URLs. A successful page.goto() call does not necessarily mean the server returned a successful HTTP status: 404 and 500 responses can still produce a navigation response. This example logs the status instead of treating every received response as success. Playwright documents navigation and screenshot options in the Page API.

#1 Best Overall

Choose what each PNG contains

Viewport or full page

The example sets a 1440 × 900 viewport and fullPage: true. Remove fullPage: true to capture only the visible viewport. Playwright describes full-page mode as capturing “the full scrollable page, instead of the currently visible viewport.” A long page can produce a very tall image, so check the resulting dimensions and whether downstream image tools can handle them. There is no universally useful maximum page length.

PNG format and output paths

With a file path, Playwright can infer the image format from the extension; the example also specifies type: 'png' explicitly. PNG does not use the screenshot API’s quality option. Keep output names unique: using a fixed filename in a loop overwrites earlier captures. Numbered names are simple and safe; if you use URL-derived names, sanitize path characters, disambiguate duplicates, and avoid putting sensitive query values in filenames.

Save to disk or keep bytes in memory

To upload or process an image without first writing it to a path, omit path and use the returned buffer:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
const imageBytes = await page.screenshot({ type: 'png', fullPage: true });
// Pass imageBytes to your upload, storage, or image-processing code.

The screenshot call returns the image bytes; writing or uploading them is application-specific. See the Playwright screenshots guide for buffer examples. That URL is on Playwright’s next documentation channel and may change.

Rank #2
Dell Latitude 5420 14" FHD Business Laptop Computer, Intel Quad-Core i5-1145G7, 16GB DDR4 RAM, 256GB SSD, Camera, HDMI, Windows 11 Pro (Renewed)
  • 256 GB SSD of storage.
  • Multitasking is easy with 16GB of RAM
  • Equipped with a blazing fast Core i5 2.00 GHz processor.

Make the batch reliable for your pages

Wait for the content you need

waitUntil: 'load' waits for the page load event, but does not guarantee that delayed images, fonts, client-side data, animations, or embedded widgets have settled. For a known application, wait for a site-specific selector or other readiness condition before taking the screenshot. No single wait condition guarantees visual readiness on every arbitrary website; choose and validate one for the pages you capture.

Handle errors and status deliberately

Record the input URL, response status when available, output path, and any exception for every item. A missing response can occur when navigation fails before a response is received. Decide whether non-success HTTP status codes should still produce an image or count as a failed item; the example captures the rendered response and logs its status. DNS, TLS, timeout, policy, and site-side blocking failures should be reported per URL rather than silently discarded.

Keep concurrency bounded

A sequential loop is easier to debug and limits simultaneous browser work. A browser context can contain multiple pages, which enables parallel captures, and pages share context-level settings such as viewport, locale, and routes. Playwright does not prescribe a universal concurrency level: it depends on your machine, the pages, and the target sites. If throughput matters, add a bounded worker pool, monitor failures and resource use, and avoid launching unbounded work against sites.

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

Make repeat runs comparable

Live pages change, and rendering can differ with the operating system, browser version, machine settings, hardware, and headless mode. For screenshot comparisons, keep the capture environment consistent with the baseline. Playwright’s visual comparisons guidance discusses these sources of variation.

Rank #3
15.6 Inch Win 11 Laptop Computer, N4020, 4GB DDR4 RAM, 128GB Storage | LPDDR4 RAM, 180° Lay-Flat, Dual-Band WiFi, Type-C PD Fast Charging, Thin & Lightweight for Students, Home & Office, Gray
  • WINDOWS 11 | STABLE PERFORMANCE: Powered by Intel Celeron N4020 processor and Windows 11 system, this laptop delivers stable performance for everyday computing tasks. It supports web browsing, online learning, document editing, email communication, and basic office work with optimized power efficiency, providing a practical and reliable experience for essential daily use for daily use.
  • 15.6” FHD IPS DISPLAY: Features a 15.6-inch Full HD IPS display with narrow bezels, offering wider viewing angles and clearer image details compared to standard panels. The improved screen-to-body ratio enhances visual experience for study, reading, document work, and video playback, making it suitable for both productivity and entertainment use.
  • 4GB DDR4 + 128GB eMMC STORAGE: Equipped with 4GB DDR4 memory and 128GB eMMC storage for everyday basics such as browsing, documents, email, and online learning platforms. The built-in TF card slot supports storage expansion up to 1TB, giving you more flexibility for files, photos, videos, and daily documents. TF card not included.
  • CONNECTIVITY & PORTS: Includes 1× TF card slot, 2× USB 3.2 Gen1 ports, and 2× full-featured Type-C ports (USB 3.2 Gen1). The Type-C ports support data transfer, charging, and video output, enabling flexible connection with external devices such as monitors, storage, and peripherals for daily work and study use.
  • LIGHTWEIGHT DESIGN | ONLINE COMMUNICATION: Designed with a slim, portable profile, this laptop is easy to carry for school, commuting, and travel. A built-in 1MP front camera supports online classes, video meetings, remote communication, and everyday conferencing. The 3300mAh battery works with the low-power system design to support practical daily use, while thermal optimization helps maintain quieter operation during extended tasks.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common problems

  • “Executable doesn’t exist” or browser launch fails: install the browser matching the package with npx playwright install chromium, and check that the runtime environment permits launching it.
  • Navigation times out: the site may be slow, blocked, or waiting on long-running resources. Check the URL and network access; increase the timeout only when a longer wait is appropriate, and choose a readiness condition suited to the site.
  • The output is blank or incomplete: navigation completion may precede application rendering or delayed media. Wait for a relevant selector or page-specific state, and confirm that the page is not showing a consent screen or access challenge.
  • A 404 or 500 image is still saved: HTTP error statuses do not necessarily make page.goto() throw. Inspect the returned response status and decide whether to keep or reject that capture.
  • Images overwrite one another: assign a distinct path to every input. Index-based filenames, as in the example, avoid path sanitization and duplicate-URL collisions.
  • Captures differ between machines or runs: standardize the browser, operating system, viewport, and execution mode; also account for changes to live page content.
  • Full-page output is unwieldy: use viewport capture when only the initial visible area is required, or review image dimensions and downstream limits before retaining very tall files.

Or skip the browser setup

ScreenshotNeo offers a one-request alternative: its API can return a PNG, JPEG, WebP, or PDF for a URL. The request below follows the ScreenshotNeo API documentation; replace YOUR_API_KEY with your key.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

ScreenshotNeo accepts cookie and consent banners as a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for AI agents and other MCP clients. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots.

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

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.

Related Playwright language guides

The JavaScript pattern here is based on Playwright’s Node API. Official guides also show screenshot capture in Python, Java, and .NET. The same choices apply: set a unique output path, select viewport or full-page capture, and decide how your batch handles page readiness and errors.

Frequently Asked Questions

Can Playwright capture a single element instead of the whole page?

Yes. Use the locator screenshot method for the element you want, rather than taking a page screenshot.

Can one batch produce both screenshots and PDFs?

Playwright has separate screenshot and PDF workflows; PDF output is not a PNG screenshot. Choose the output method that matches the artifact you need.

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 *

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.