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

Use Playwright to read URLs from a file, capture each page in one reusable browser process, and flag screenshots whose pixels show unusually little variation. Treat that flag as a review candidate—not proof of a failed page: a plain or intentionally empty page can also look uniform. The script below records navigation failures separately from image findings.

What the workflow can—and cannot—tell you

A batch capture has two distinct results to track: whether the browser loaded and captured the page, and whether the resulting image looks unusually uniform. A navigation error or timeout is not the same as a valid screenshot that happens to contain a blank-looking page.

Playwright’s Page API supports navigation and screenshots saved to a file, full-page capture, and screenshot bytes for further processing (Playwright Page API; Playwright screenshot documentation). The pixel-variation check below is a practical heuristic, not a built-in Playwright blank-page classifier. Playwright does not prescribe a universal score or cutoff for blank images.

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

Install Playwright and prepare a URL list

The example uses Node.js, Playwright, and the sharp image library. It reads one URL per line from urls.txt, writes images and a JSONL results file, and continues after individual navigation errors.

#1 Best Overall
Sale
Epson Workforce ES-50 Compact & Lightweight Mobile Document Scanner
  • 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
  1. Install a current Node.js release if it is not already available.
  2. In a new project directory, run npm init -y.
  3. Install dependencies with npm install playwright sharp.
  4. Install Playwright’s Chromium browser with npx playwright install chromium.
  5. Create urls.txt, putting one complete URL on each line. Lines beginning with # and empty lines are ignored.

Capture the URL list and flag low-variation images

Save this as bulk-screenshot.js. By default, it captures each page’s visible viewport. Set FULL_PAGE=1 to capture the full scrollable page. The example uses a simple luminance standard deviation across sampled pixels; its initial cutoff is a starting point to calibrate against your pages, not a universal threshold.

const fs = require('node:fs/promises');
const path = require('node:path');
const { chromium } = require('playwright');
const sharp = require('sharp');

const inputFile = process.argv[2] || 'urls.txt';
const outputDir = process.env.OUTPUT_DIR || 'screenshots';
const fullPage = process.env.FULL_PAGE === '1';
const timeoutMs = Number(process.env.NAV_TIMEOUT_MS || 30000);
const blankStddevThreshold = Number(process.env.BLANK_STDDEV || 3);

async function luminanceStats(buffer) {
  const { data, info } = await sharp(buffer)
    .flatten({ background: '#ffffff' })
    .resize({ width: 200, height: 200, fit: 'inside' })
    .removeAlpha()
    .raw()
    .toBuffer({ resolveWithObject: true });
  const values = [];
  for (let i = 0; i < data.length; i += info.channels) {
    const r = data[i], g = data[i + 1], b = data[i + 2];
    values.push(0.2126 * r + 0.7152 * g + 0.0722 * b);
  }
  const mean = values.reduce((sum, value) => sum + value, 0) / values.length;
  const variance = values.reduce((sum, value) => sum + (value - mean) ** 2, 0) / values.length;
  return { meanLuminance: Number(mean.toFixed(2)), luminanceStddev: Number(Math.sqrt(variance).toFixed(2)) };
}

(async () => {
  await fs.mkdir(outputDir, { recursive: true });
  const lines = (await fs.readFile(inputFile, 'utf8')).split(/r?n/);
  const urls = lines.map(line => line.trim()).filter(line => line && !line.startsWith('#'));
  const resultsPath = path.join(outputDir, 'results.jsonl');
  const results = await fs.open(resultsPath, 'w');
  const browser = await chromium.launch({ headless: true });
  const context = await browser.newContext({ viewport: { width: 1440, height: 1000 } });

  try {
    for (let index = 0; index < urls.length; index++) {
      const url = urls[index];
      const id = String(index + 1).padStart(4, '0');
      const record = { id, url, capturedAt: new Date().toISOString(), fullPage };
      const page = await context.newPage();
      try {
        const response = await page.goto(url, { waitUntil: 'domcontentloaded', timeout: timeoutMs });
        record.finalUrl = page.url();
        record.httpStatus = response ? response.status() : null;
        const imagePath = path.join(outputDir, `${id}.png`);
        const buffer = await page.screenshot({ path: imagePath, fullPage, animations: 'disabled' });
        const metadata = await sharp(buffer).metadata();
        record.screenshot = imagePath;
        record.width = metadata.width;
        record.height = metadata.height;
        Object.assign(record, await luminanceStats(buffer));
        record.blankCandidate = record.luminanceStddev < blankStddevThreshold;
        record.outcome = record.blankCandidate ? 'captured_low_variation_review' : 'captured';
      } catch (error) {
        record.outcome = 'navigation_or_capture_error';
        record.error = String(error.message || error);
        record.finalUrl = page.url();
      } finally {
        await page.close();
      }
      await results.write(`${JSON.stringify(record)}n`);
      console.log(`${record.id} ${record.outcome} ${record.url}`);
    }
  } finally {
    await context.close();
    await browser.close();
    await results.close();
  }
})().catch(error => {
  console.error(error);
  process.exitCode = 1;
});

Run it with node bulk-screenshot.js urls.txt. To capture full pages, use FULL_PAGE=1 node bulk-screenshot.js urls.txt. Images are named by input order, such as 0001.png; screenshots/results.jsonl contains one record per input URL, including timestamp, final URL, HTTP status when available, dimensions, detector values, and outcome. A successful capture with an HTTP error status is still recorded as a capture; inspect the status and page content according to your needs.

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)

Understand and calibrate the blank-candidate rule

The script shrinks each image to at most 200 pixels on each side and calculates the standard deviation of sampled luminance values. When that variation is below BLANK_STDDEV, it marks the record for review. The default value of 3 is merely an initial setting in this example; no universal cutoff is established.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Review representative pages before processing a large list: typical content, an intentionally plain page, a loading or error state, a consent screen, a dark page, and pages with mostly solid-color branding.
  • Compare flagged and unflagged samples, then adjust the cutoff for your own pages with BLANK_STDDEV=VALUE.
  • Low variation can mean an intentional design, a blocked or incomplete page, or a viewport that misses the page’s content. It is a prompt to inspect the image, not an automated verdict.
  • Full-page captures can behave differently from viewport captures: they include more content, create larger images, and can change the variation score. Keep capture mode consistent when comparing results.

Choose capture settings for the job

Viewport or full page

Viewport screenshots are faster and smaller, but can miss content below the fold. Full-page screenshots include the scrollable page and are useful when the target content may appear lower down; they can take more resources and alter the blankness heuristic’s result.

Rank #3
Sale
Epson Workforce ES-400 II High-Speed Color Duplex Desktop Document Scanner
  • FAST DOCUMENT SCANNING — Document scanner with feeder allows you to speed through stacks with a 50-sheet Auto Document Feeder (ADF); Efficient office scanner to help you scan more productively
  • INTUITIVE, HIGH-SPEED SOFTWARE — Quickly scan with this desktop document scanner; Epson ScanSmart Software lets you easily preview scans, email files, upload to the cloud, and more; Plus, automatic file naming saves even more time
  • SEAMLESS INTEGRATION — Easily incorporate your data into most document management software with the included TWAIN driver; Office document scanner integrates seamlessly with business workflows
  • EASY SHARING — Duplex scanner allows you to scan straight to email or popular cloud storage2 services like Dropbox, Evernote, Google Drive, and OneDrive for simple storage and sharing
  • SIMPLE FILE MANAGEMENT — Scanner allows the creation of searchable PDFs with Optical Character Recognition (OCR) and convert scans to editable Word or Excel files effortlessly; Designed for home and office document scanning

Navigation readiness and dynamic content

The example waits for domcontentloaded so it does not depend on every network request finishing. This is useful for pages with analytics or long-lived requests, but a page that renders its main content later may be captured too early. If that happens, use a site-specific readiness condition such as a selector wait or a deliberate delay before taking the screenshot. Avoid treating a fixed delay as proof that all content is ready.

Repeatability and visual regression

Keep browser version, operating system, viewport, scale, headless mode, and machine conditions consistent when image results need to be comparable. Playwright notes that rendering can vary with host OS, browser version and settings, hardware, power source, and headless mode (Playwright visual comparisons).

Rank #4
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

If every URL has a trusted expected image and your goal is to detect visual changes rather than discover blankness, Playwright Test’s toHaveScreenshot() is a different tool for the job. It waits until two consecutive screenshots match before comparing against the expected snapshot, and offers image-difference controls. It does not provide a generic blank-image detector. See the PageAssertions options.

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

Handle larger batches responsibly

This script reuses one browser and context but opens and closes a page for each URL sequentially. That keeps resource usage simpler and makes the first run easier to diagnose. For very large lists, runtime grows with page load and capture time; introduce a small, controlled number of concurrent pages only after measuring memory and stability on your own machines. Too much concurrency can increase timeouts and incomplete renders.

Best Value
Sale
ScanSnap iX2500 Wireless or USB High-Speed Document Scanner, Black
  • OUR MOST ADVANCED SCANSNAP. Large touchscreen, fast 45ppm double-sided scanning, 100-sheet document feeder, Wi-Fi and USB connectivity, automatic optimizations, and support for cloud services. Upgraded replacement for the discontinued iX1600
  • CUSTOMIZABLE. SHARABLE. Select personalized profiles from the touchscreen. Send to PC, Mac, mobile devices, and clouds. QUICK MENU lets you quickly scan-drag-drop to your favorite computer apps
  • STABLE WIRELESS OR USB CONNECTION. Built-in Wi-Fi 6 for the fastest and most secure scanning. Connect to smart devices or cloud services without a computer. USB-C connection also available
  • PHOTO AND DOCUMENT ORGANIZATION MADE EFFORTLESS. Easily manage, edit, and use scanned data from documents, receipts, photos, and business cards. Automatically optimize, name, and sort files
  • AVOIDS PAPER JAMS AND DAMAGE. Features a brake roller system to feed paper smoothly, a multi-feed sensor that detects pages stuck together, and skew detection to prevent paper damage and data loss

Retain the JSONL manifest alongside images so you can identify which input produced each file and distinguish browser failures from low-variation images. If you rerun a list, preserve the same input ordering or use URL-derived stable IDs in your own workflow to make comparisons easier. There is no general performance figure or blank-detection accuracy guaranteed by Playwright for this custom implementation.

Troubleshooting

  • Chromium executable is missing: run npx playwright install chromium in the project and retry.
  • A URL fails immediately: make sure each non-comment line is a complete URL with a scheme such as https://; inspect the recorded error and final URL.
  • Navigation timeout: some pages never reach the chosen readiness state or respond slowly. Increase NAV_TIMEOUT_MS for the run, or choose a more suitable readiness strategy for that site. A timeout is recorded as an error, not a blank screenshot.
  • Images are blank although the page loads: the site may render content after domcontentloaded. Wait for the relevant content selector or a site-appropriate delay before capture, then check whether the page requires authentication or blocks automated browsers.
  • Too many false blank flags: lower or otherwise recalibrate BLANK_STDDEV using reviewed examples. Uniform backgrounds, sparse layouts, and intentionally simple pages can have low variation.
  • Missed blank pages: a page can be mostly uniform while containing a small meaningful region that affects the score. Review the images and consider additional checks suited to your content, rather than assuming one global pixel threshold is sufficient.
  • Images differ between runs: standardize browser and machine settings and account for animations, dynamic content, time-dependent text, and rotating content. The example disables animations during screenshot capture, but cannot make a changing site deterministic.
  • Memory use rises on long pages: try viewport capture, reduce concurrency if you added it, and process a manageable number of URLs per run.

Or skip the browser setup

ScreenshotNeo can return a screenshot from one request; its clean-shot steps accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets, with each step configurable. It bills only clean shots: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and responses identify outcomes with X-Page-Verdict and X-Billed headers. It also provides an MCP server with screenshot, page-info, and PDF tools for AI agents. The service includes 1,000 screenshots a month free with no card; paid plans start at $5 for 3,000 shots. Its response headers identify blank-page outcomes, but the pixel-variation heuristic above is still useful when you want to inspect and classify saved image files yourself.

Use the following cURL request, substituting your target URL and API key. See the ScreenshotNeo API documentation for parameters and response details.

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

Sign up for ScreenshotNeo to get 1,000 screenshots a month free with no card.

Frequently Asked Questions

Does Playwright provide a built-in blank screenshot detector?

No. The pixel-variation check in the example is custom logic, and its threshold must be calibrated for the pages being captured.

Should I use a visual snapshot assertion to find blank pages?

Use visual assertions when you have trusted expected images and want to detect changes. They compare against a baseline; they are not a generic blank-image classifier.

Quick Recap

Bestseller No. 4
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.

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.