Skip to content

Repository files navigation

Node.js Screenshot Benchmarks

Companion examples and benchmarks for the Screenshot Scout article How to Take Website Screenshots in Node.js (Benchmarked).

The project has two parts:

  • copy-pasteable TypeScript examples for Playwright, Puppeteer, Selenium WebDriver, and Screenshot Scout;
  • reproducible benchmark runners for performance and reliability screenshots.

Setup

Install Node.js 24 LTS. This repository targets Node.js 24, pins 24.19.0 in .nvmrc, pins every direct dependency in package.json, and commits package-lock.json.

Install dependencies, compile the TypeScript runner, and prewarm browser and extension caches:

npm ci
npm run build
npm run setup

Playwright uses Playwright-managed Chromium. Puppeteer uses its bundled compatible Chrome. Selenium Manager resolves Chrome and ChromeDriver.

Screenshot Scout examples and benchmarks require an access key.

On Windows PowerShell:

$env:SCREENSHOTSCOUT_ACCESS_KEY = "your_access_key"

On macOS/Linux:

export SCREENSHOTSCOUT_ACCESS_KEY=your_access_key

Only SCREENSHOTSCOUT_ACCESS_KEY is accepted.

Examples

Each example is standalone and designed to appear verbatim in the article. Compile once, then run any example:

npm run build
npm run example:playwright:screenshot
npm run example:playwright:full-page
npm run example:playwright:element

Equivalent scripts exist for puppeteer, selenium, and screenshot-scout. Run all nine local-browser examples with npm run examples:local, or all twelve with npm run examples:all after setting a Screenshot Scout key.

Benchmarks

npm run build
npm run benchmark

The combined benchmark command creates one timestamped run folder and runs both performance measurements and reliability screenshot capture into it.

Performance measurements use cold starts: launch, capture, close. Each trial starts a fresh compiled Node.js worker and browser or SDK client. The runner records wall time, peak local RAM, local CPU-seconds, average cores busy, and average CPU load percent by sampling the worker process tree.

By default, performance runs benchmark normal viewport screenshots. Optional --performance-kind full_page and --performance-kind selector modes are available for exploratory measurements; selector mode uses selector from manifests/performance.toml.

Screenshot Scout rendering happens on Screenshot Scout infrastructure, so local CPU/RAM numbers represent only client-side SDK request handling. Wall time still measures how long the screenshot request takes from start to finish.

The reliability runner captures each configured page once per tool and saves screenshots under runs/<timestamp>/screenshots/reliability/. It does not grade pass/fail.

Reliability runs also write runs/<timestamp>/results/reliability_raw.csv for manual grading. After filling the result column, run:

npm run summarize -- runs/<timestamp>/results/reliability_raw.csv

See running instructions, methodology, and reliability grading for the complete workflow.

Docker

docker build -t nodejs-screenshot-benchmarks .
docker run --rm -it --shm-size=2g -e SCREENSHOTSCOUT_ACCESS_KEY="$env:SCREENSHOTSCOUT_ACCESS_KEY" -v "${PWD}/runs:/app/runs" nodejs-screenshot-benchmarks

Then run npm run benchmark inside the container. See Docker instructions.

Cleanup And Stealth

Local browser-library reliability benchmarks use:

  • uBlock Origin Lite 2026.729.1529 for ad removal;
  • I Still Don't Care About Cookies v1.1.9 for cookie-warning cleanup;
  • Zorilla wrappers and stealth evasions for bot-protection captures.

The benchmark downloads and verifies pinned extension releases during setup. Each extension capture uses a fresh temporary browser profile.

ISDCAC runs with its packaged defaults. It removes cookie warnings rather than acting as a strict cookie or tracker blocker, and the reliability benchmark measures its actual coverage.

Normal performance runs do not enable cleanup extensions or stealth.

For manual comparison screenshots:

npm run bot-comparison -- --tool playwright --url https://bot.sannysoft.com/ --output-dir manual-screenshots

Outputs

Each run writes:

runs/<timestamp>/
  screenshots/
    reliability/
  results/
    performance_raw.csv
    performance_summary.csv
    run_metadata.json
    reliability_raw.csv
    reliability_summary.csv  # after manual grading and summarization

Tests

npm test

Normal tests do not consume Screenshot Scout credits or require browsers. After npm run setup, opt into local-browser and extension tests with:

$env:RUN_BROWSER_INTEGRATION = "1"
$env:RUN_EXTENSION_INTEGRATION = "1"
npm test

The live SDK smoke test additionally requires RUN_LIVE_SCREENSHOTSCOUT=1 and SCREENSHOTSCOUT_ACCESS_KEY.

About

Companion examples and benchmarks for the Screenshot Scout Node.js screenshot article.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages