To capture multiple independent pages at once with Playwright, create a separate Page for each target, start each page’s navigation and screenshot task, then wait for the tasks to finish. For a small batch, Promise.all() is straightforward; for a large batch, use a concurrency limit so you do not launch an unbounded number of browser pages. Use separate browser contexts when captures need different cookies or other context-level settings.
Capture several URLs in parallel with a standalone script
Playwright’s page.screenshot() captures one page, and a browser can host multiple pages. That makes independent pages a practical unit of work for independent URLs. The example below uses Chromium, creates one page per target in a shared context, writes each image to a unique file, and closes each page when its task finishes. The browser stays open until all tasks have settled.
Install Playwright and its Chromium browser if they are not already available in your project. Save this as an ES module, for example capture.mjs, then run node capture.mjs. The API behavior is documented in Playwright’s Page API and Pages guide.
import { chromium } from 'playwright';
const targets = [
{ name: 'home', url: 'https://example.com' },
{ name: 'docs', url: 'https://playwright.dev' },
];
const browser = await chromium.launch();
const context = await browser.newContext();
try {
const jobs = targets.map(async ({ name, url }) => {
const page = await context.newPage();
try {
await page.goto(url, { waitUntil: 'load', timeout: 30_000 });
await page.screenshot({ path: `${name}.png`, fullPage: true });
} finally {
await page.close();
}
});
const results = await Promise.allSettled(jobs);
const failures = results.filter((result) => result.status === 'rejected');
if (failures.length) {
throw new AggregateError(
failures.map((failure) => failure.reason),
`${failures.length} screenshot job(s) failed`,
);
}
} finally {
await browser.close();
}
Promise.allSettled() here ensures that a failed navigation does not cause the script to close the browser while other captures are still running. The script still exits with an error if any job fails. If you prefer to fail as soon as one task rejects, use Promise.all(), but make sure your cleanup strategy accounts for other tasks that may still be running.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Choose the right navigation and capture settings
- Wait condition:
loadwaits for the page load event. If the page continues rendering after that, wait for a meaningful selector withpage.waitForSelector(), or use a short, deliberate delay where the site requires it. Avoid assuming one wait condition fits every site. - Full page or viewport:
fullPage: truecaptures the full scrollable page; omit it for a viewport-only image. - Output names: use a unique filename per job. Reused paths can overwrite images when parallel work targets the same location.
- Error policy: decide whether one failed URL should fail the whole batch, as above, or whether to log failures and keep successful images. Either way, close pages and the browser in cleanup paths.
Limit concurrency for larger batches
Starting every URL at once is reasonable only for a small, controlled set. Each active page consumes browser and machine resources, and target sites may impose their own limits. Playwright’s documentation does not specify a universally optimal concurrency for standalone screenshot scripts. Set a limit and tune it against your own machine, pages, and sites rather than relying on a generic worker count.
This worker-pool pattern processes a large target list with at most limit active jobs. It preserves input order in the results array; each result records success or failure, so one bad URL does not discard other outcomes.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
async function captureWithLimit(targets, limit, context) {
if (!Number.isInteger(limit) || limit < 1) {
throw new Error('limit must be a positive integer');
}
const results = new Array(targets.length);
let nextIndex = 0;
async function worker() {
while (true) {
const index = nextIndex++;
if (index >= targets.length) return;
const { name, url } = targets[index];
const page = await context.newPage();
try {
await page.goto(url, { waitUntil: 'load', timeout: 30_000 });
await page.screenshot({ path: `${name}.png`, fullPage: true });
results[index] = { name, ok: true };
} catch (error) {
results[index] = { name, ok: false, error };
} finally {
await page.close();
}
}
}
await Promise.all(
Array.from({ length: Math.min(limit, targets.length) }, () => worker()),
);
return results;
}
Call it inside the same browser/context lifecycle as the first example, then inspect each result. If your target list contains duplicate names, generate unique output paths (for example, from a stable ID or index) before starting the workers.
Choose pages or contexts based on state
Pages in one context share that context’s browser profile and settings. Use that arrangement when captures should share cookies or the same emulation configuration. Create separate contexts when jobs need different cookies, storage, locale, viewport, or other context-level settings; contexts provide a more isolated browser profile. See Playwright’s BrowserContext API for context behavior.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
| Capture setup | Use it when | Trade-off |
|---|---|---|
| Multiple pages in one context | Targets can share cookies, storage, and context settings. | State or settings shared within that context may affect captures. |
| Separate contexts | Targets require different profiles or emulation settings. | You must create and manage the additional contexts. |
Use Playwright Test workers for parallel tests
If screenshots are part of an automated test suite, distinguish test-runner parallelism from parallel pages inside a single test. Playwright Test runs test files in parallel by default, while tests in a file run in order unless you configure parallel mode. You can set worker count on the command line, for example npx playwright test --workers 4; --workers=1 disables parallel execution. The runner’s worker setting controls test scheduling, not an arbitrary group of promises inside one test. See the official Parallelism guide.
To run tests within a file in parallel, configure the suite with test.describe.configure({ mode: 'parallel' }). Each Playwright Test worker has its own browser and isolated BrowserContext, which separates cookies, storage, and in-memory globals. It does not isolate a shared database, remote account, or shared filesystem. Give tests independent backend records and test-scoped output paths to avoid collisions.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
For visual regression, use screenshot assertions
For a visual comparison rather than simply saving an image, use Playwright Test’s expect(page).toHaveScreenshot(). The assertion waits for two consecutive screenshots to match before comparing the result with the expected baseline. It is a test-runner assertion, not a replacement for page.screenshot() in a standalone capture script. See Visual comparisons and the PageAssertions API.
Rendering can vary with operating system, browser version, settings, hardware, power source, and headless mode. Create and compare baselines in the same environment where practical, and review baseline changes before committing them.
Recommended Free Tools
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Troubleshoot parallel screenshot jobs
- Some output files are missing: check the job results and logs for navigation or screenshot errors. A failed navigation can reject its task; record failures explicitly if successful captures should still be retained.
- Images overwrite one another: assign unique output paths to every target and every concurrent test. Parallel workers do not make a shared filename safe.
- Pages show unexpected state: verify whether the jobs should share a context. Shared context settings and browser state are intentional; use separate contexts for different profiles or emulation.
- Captures are incomplete: the page may not be visually ready at the chosen navigation event. Wait for a page-specific selector or other meaningful readiness condition rather than adding an arbitrary long wait to every job.
- The batch slows down or becomes unreliable at higher concurrency: reduce the worker limit and compare results on your actual machine and target pages. There is no documented universal standalone limit.
- Visual tests fail only on another machine: align the baseline and comparison environment where possible; rendering differences can come from host and browser conditions.
Or skip the browser setup
If you need screenshots from URLs without managing a local browser, ScreenshotNeo provides a screenshot API. A cURL request can save a WebP capture:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
See the ScreenshotNeo API documentation for request options. Cookie banners, newsletter popups, and chat widgets are removed before capture; bot checks, blank pages, and failed loads are not billed. Its MCP server lets AI agents use screenshot tools, and the free plan includes 1,000 screenshots a month with no card required; paid plans start at $5 for 3,000 screenshots. Sign up for free.
Frequently Asked Questions
Does `Promise.all()` make one Playwright page capture several URLs at once?
No. Each URL needs its own page or other independently managed target; `Promise.all()` coordinates the asynchronous jobs.
Can I run `toHaveScreenshot()` in a plain Node script?
It is a Playwright Test assertion. For a standalone script that saves an image, use `page.screenshot()`.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsQuick Recap
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.

