Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon 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 NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk7 min

How to Capture Screenshots of URLs from a CSV File with Playwright

Parse a CSV of URLs in Node.js, capture each page with Playwright, and save predictable screenshots while keeping track of failures.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a Node.js script to parse a CSV with a url header, visit each address with Playwright, and save a screenshot for each row. The example below processes URLs sequentially, captures the full page, records row-level failures, and uses indexed filenames so two URLs cannot overwrite each other.

Prepare the CSV and Node.js project

Save a file named urls.csv beside your script. This example expects a header called url and one address per row:

As an Amazon Associate I earn from qualifying purchases.

url
https://example.com/
https://playwright.dev/

Use a CSV parser rather than splitting lines on commas: valid CSV can contain quoted fields, headers, and empty lines. Playwright’s parameterization guide notes that its test runner runs in Node.js, where files can be read and parsed with a preferred CSV library; its example uses csv-parse/sync with header columns and skipped empty lines (Playwright parameterize tests).

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.
  1. Install Node.js if it is not already available.
  2. In a new project directory, run npm init -y.
  3. Install the packages: npm install playwright csv-parse.
  4. Install Playwright’s Chromium browser: npx playwright install chromium.
  5. Save the CSV and the script below in that project directory.

The script uses ES module imports. Set the project to use modules by adding "type": "module" to the top-level of package.json, or save the file with an .mjs extension.

#1 Best Overall
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner | For Computers including PC and Mac Receipt and Document Scanner USB Powered
  • PORTABLE SCANNER FOR USE ON-THE-GO — The fastest and lightest mobile single-sheet-fed compact document scanner in its class¹
  • QUICK DOCUMENT SCANNING ― This Epson ultra-fast scanner scans a single page as quickly as 5.5 seconds²; Windows and Mac compatible
  • VERSATILE PAPER HANDLING ― Portable scanner scans documents up to 8.5 x 72 in; Also easily digitizes receipts and ID cards to make accounting, bookkeeping, and organizing simpler
  • INTUITIVE, HIGH-SPEED SOFTWARE — Epson ScanSmart Software³ is a smart tool allowing you to easily scan, review, and save; Stay organized easily with the help of this Epson scanner
  • EASY SETUP — USB-powered connect to your computer for quick and simple scanning; No batteries or external power supply required to operate portable document scanner; Standard Connectivity: USB 2.0

Run a sequential CSV-to-screenshot script

Save this as capture.js (or capture.mjs). It creates a screenshots directory, reuses one page, saves full-page PNGs with stable row-index names, and continues after an individual navigation or capture error.

import fs from 'node:fs';
import path from 'node:path';
import { parse } from 'csv-parse/sync';
import { chromium } from 'playwright';

const inputFile = 'urls.csv';
const outputDir = 'screenshots';
const rows = parse(fs.readFileSync(inputFile), {
  columns: true,
  skip_empty_lines: true,
});

fs.mkdirSync(outputDir, { recursive: true });
const browser = await chromium.launch();
const failures = [];

try {
  const page = await browser.newPage();

  for (const [index, row] of rows.entries()) {
    const url = row.url?.trim();
    if (!url) {
      failures.push({ row: index + 2, url: '', error: 'Missing url value' });
      continue;
    }

    const filename = `page-${String(index + 1).padStart(4, '0')}.png`;
    const outputPath = path.join(outputDir, filename);

    try {
      await page.goto(url, { waitUntil: 'load', timeout: 30000 });
      await page.screenshot({ path: outputPath, fullPage: true });
      console.log(`Saved ${outputPath} for ${url}`);
    } catch (error) {
      const message = error instanceof Error ? error.message : String(error);
      failures.push({ row: index + 2, url, error: message });
      console.error(`Failed CSV row ${index + 2} (${url}): ${message}`);
    }
  }
} finally {
  await browser.close();
}

fs.writeFileSync('screenshot-failures.json', JSON.stringify(failures, null, 2));
console.log(`Finished. ${failures.length} row(s) failed; see screenshot-failures.json.`);

Run it with node capture.js. Successful images appear in screenshots/; failed rows, including the CSV row number and URL, are written to screenshot-failures.json. Since the header is row 1, the first data record is CSV row 2. Blank lines are skipped by the parser; a nonblank record whose url cell is empty is logged as a missing value.

Choose what counts as a screenshot

Viewport or full page

By default, a Playwright screenshot captures the visible viewport. Set fullPage: true to capture the full scrollable page; set it to false or omit it for viewport-only output. The full-page option is documented by the Playwright Page API. Very long pages can produce large images, so choose based on whether you need the page as a whole or only what is visible at a particular viewport.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Brother DS-640 Compact Mobile Document Scanner, (Model: DS640)
  • FAST SPEEDS - Scans color and black and white documents a blazing speed up to 16ppm (1). Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • ULTRA COMPACT – At less than 1 foot in length and only about 1. 5lbs in weight you can fit this device virtually anywhere (a bag, a purse, even a pocket).
  • READY WHENEVER YOU ARE – The DS-640 mobile scanner is powered via an included micro USB 3. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan.
  • WORKS YOUR WAY – Use the Brother free iPrint&Scan desktop app for scanning to multiple “Scan-to” destinations like PC, Network, cloud services, Email and OCR. (2) Supports Windows, Mac and Linux and TWAIN/WIA for PC/ICA for Mac/SANE drivers. (3)
  • OPTIMIZE IMAGES AND TEXT – Automatic color detection/adjustment, image rotation (PC only), bleed through prevention/background removal, text enhancement, color drop to enhance scans. Software suite includes document management and OCR software. (4)

Navigation readiness

The example waits for the browser’s load event, then captures. That is a simple starting point, not proof that every site’s dynamic content, animations, or delayed images are ready. If a page fills in after load, wait for a selector that identifies the needed content before taking the screenshot:

await page.goto(url, { waitUntil: 'load', timeout: 30000 });
await page.locator('main .report-ready').waitFor({ state: 'visible', timeout: 10000 });
await page.screenshot({ path: outputPath, fullPage: true });

Replace the selector with one specific to the site. A fixed delay is possible, but it can waste time on fast pages and still be too short on slow ones; a meaningful readiness condition is usually more reliable when the site provides one.

Filenames and manifests

The row-index filename makes output deterministic and avoids collisions when multiple URLs have the same hostname or path. To make files easier to identify, add a sanitized hostname while retaining the index. For workflows that need to map every output back to its input, write a manifest containing the CSV row, URL, output path, and status. Do not use an unsanitized URL directly as a filename; URLs contain characters that are invalid or awkward in file paths.

Rank #3
Sale
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
  • STAY ORGANIZED – Easily convert your paper documents into digital formats like searchable PDF files, JPEGs, and more.Power Consumption : 2.5W or less (Energy Saving Mode: 0.7W). Suggested Daily Volume : 500 scans..Does it contain liquid: no
  • CONVENIENT AND PORTABLE –lightweight and small in size, you can take the scanner anywhere from home offices, classrooms, remote offices, and anywhere in between
  • HANDLES VARIOUS MEDIA TYPES – Digitize receipts, business cards, plastic or embossed cards, reports, legal documents, and more
  • FAST AND EFFICIENT – No technical hurdles or complicated setups here; easily scan both sides of a document at the same time, in color or black-and-white, at up to 12 pages-per-minute, and with a 20 sheet automatic feeder
  • BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer

Adapt the batch strategy

Reuse a page or create one per URL

One reused page is simple and avoids creating a new page for every row. It also means each navigation uses the same page context. If rows need separate cookies, storage, or other browser state, create a fresh browser context or page per row and close it after capture. The appropriate isolation level depends on the sites and what the screenshots must represent.

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

Sequential or concurrent captures

The example is sequential: it opens the next URL after the current screenshot attempt finishes. This is easy to reason about and limits simultaneous browser work and requests to sites. Concurrency can shorten a large batch’s elapsed time, but raises memory and CPU use and can trigger rate limits or defensive responses on target sites. Start sequentially; add a small, controlled concurrency limit only when needed, and retain row-level error reporting.

Standalone script or Playwright Test

A standalone Node.js script is a direct fit for a one-off or scheduled batch job. Playwright Test is useful when the capture is part of a test suite or when you need test-runner features; Playwright’s CSV guide demonstrates reading input data in that environment. The browser automation itself can still use the Page API’s navigation and screenshot methods.

Rank #4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
  • IRIScan Express, portable scanner : scans color and black and white documents a blazing speed up to 8ppm simplex. Color scanning won’t slow you down as the color scan speed is the same as the black and white scan speed.
  • IRIScan Express mobile scanner is powered via an included micro USB 2. 0 cable allowing you to use it even where there is no outlet available. Plug it into you PC or laptop and you are ready to scan. USB cable provided. AC Adapter not provided and not needed.
  • IRIScan flatbed scanner uses a simplex scanning mode allows for quick and straightforward scanning of single-sided documents. IRIScan with its full portable features is the ideal document scanners for computers.
  • IRIScan document scanner : Versatile scanning capabilities, including scanning to Word, PDF, and Excel formats with companion software provided Readiris OCR
  • Receipt scanner and card scanner with Additional features include scanning business cards directly to Outlook, photo scanning, and receipt scanning for efficient document management

Repeatability, performance, and cost

For visual baselines, run captures in a consistent environment. Playwright cautions that rendering can vary with operating system, browser version, settings, hardware, power source, and headless mode (Playwright visual comparisons). Keep the browser version, viewport, device scale factor, locale, color scheme, and execution mode fixed if you intend to compare images over time.

There is no universal completion signal or capture speed for arbitrary websites. Network conditions, page complexity, browser resources, and site behavior affect how long each row takes. Set timeouts suitable for the batch, monitor failures rather than assuming all rows succeeded, and consider whether full-page images are necessary for every URL. For a large run, save progress as each row completes so an interrupted process does not require starting from scratch.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

  • “Cannot use import statement outside a module”: mark the package as an ES module with "type": "module", or rename the script to .mjs.
  • Playwright reports that the browser executable is missing: install the matching browser with npx playwright install chromium.
  • CSV parsing fails or columns are wrong: confirm the first row contains the exact header url, the file is valid CSV, and values containing commas or quotes are properly quoted. Avoid hand-splitting lines.
  • A row is skipped as missing a URL: check for an empty cell or a different header spelling, such as URL. Header names are case-sensitive in this script.
  • Navigation times out: the host may be slow, unreachable, or waiting on page activity. Check the URL from the same machine, then choose an appropriate timeout or a readiness condition suited to that site. The per-row catch keeps later rows running.
  • The screenshot looks incomplete: load may occur before the specific content appears. Wait for a site-specific selector or readiness signal before capture.
  • Images overwrite each other: retain the row index in filenames. Hostname-only names can collide when the CSV contains multiple URLs from one site.
  • The run is slow or uses too many resources: sequential capture favors simplicity and bounded load. If increasing throughput, use limited concurrency rather than launching an uncontrolled number of pages.

Or skip the browser setup

If you would rather send each URL to a screenshot endpoint than install and maintain a local browser, ScreenshotNeo accepts one GET request per URL and returns an image or PDF. For this CSV workflow, keep the same parsing loop and call its endpoint for each row. See the ScreenshotNeo API documentation for options.

Best Value
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
  • Scanner type: Document
  • Connectivity technology: USB
  • With Auto Scan Mode, the scanner automatically detects what you're scanning
  • Digitize documents and images
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Replace the example URL with the current CSV row’s URL and use your API key. ScreenshotNeo accepts cookie/consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of these steps can be turned off. Bot checks/CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. It also has an MCP server with screenshot, page-info, and PDF-capture tools for AI agents. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000. Sign up for ScreenshotNeo’s free plan.

Frequently Asked Questions

Does the CSV need a header row?

Yes. This script expects a header named url; the parser uses the header to read each record’s URL.

Can I save JPEG or WebP instead of PNG?

Yes. Set the screenshot format and use the matching filename extension; Playwright supports image screenshot output formats documented by its Page API.

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

Can the script capture a PDF for each URL?

A page can be saved as a PDF using Playwright’s PDF capability in a supported browser, but PDF output is separate from the image screenshot flow shown here.

Quick Recap

SaleBestseller No. 3
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
Canon imageFORMULA R10 - Portable Document Scanner, USB Powered, Duplex Scanning, Document Feeder, Easy Setup, Convenient, Perfect for Mobile Users, White
BROAD COMPATIBILITY – Works with both Windows and Mac devices, be it laptop or computer; This product is not intended for scanning photographs on photo paper / photographic media
$153.00
Bestseller No. 4
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
IRIScan Express 4 Black Compact Portable USB Simplex Document Scanner, 8 PPM for Contracts, Invoices and Business Cards, Compatible with Windows, Readiris PDF Included
Find our Software here : irislink.com/start; IRIScan Express is only compatible Windows platform and not macintosh
$129.00
Bestseller No. 5
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Canon Canoscan Lide 300 Scanner (PDF, AUTOSCAN, Copy, Send)
Scanner type: Document; Connectivity technology: USB; With Auto Scan Mode, the scanner automatically detects what you're scanning
$75.00

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.

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
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

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.