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

To take bulk screenshots with Selenium in Java, create one WebDriver session, navigate through a list of URLs, wait for the state your capture requires, call getScreenshotAs for each page, and immediately copy the returned file or bytes to durable storage. Give every image a deterministic, collision-safe name and isolate failures so one bad URL does not discard the rest of the batch.

What the bulk workflow does

Selenium does not provide a separate “bulk screenshot” command. Bulk capture is a loop around the normal screenshot API:

  1. Build a list of URLs.
  2. Create an output directory.
  3. Start a WebDriver session.
  4. Navigate to one URL.
  5. Wait until the page state needed by your job is reached.
  6. Cast the driver to TakesScreenshot and call getScreenshotAs.
  7. Copy the result to a permanent filename.
  8. Record the result and continue with the next URL.

Selenium’s API describes getScreenshotAs as “Capture the screenshot and store it in the specified location.” The loop, readiness condition, naming policy, and error handling are your application’s responsibility.

Prerequisites and setup

  • Java with a build configured to include Selenium’s Java library.
  • A browser and a matching WebDriver implementation available to the process.
  • Permission to write to the output directory.
  • A URL list whose pages your automation is allowed to access.

The example below assumes Selenium classes are already on the classpath and that ChromeDriver can be constructed. Use the browser and driver arrangement appropriate for your environment; the screenshot API is the same for a conformant WebDriver implementation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • 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.

Runnable sequential Java example

This program saves one PNG per URL in a screenshots directory. The four-digit index guarantees unique names within this run, even if the input contains the same URL more than once.

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.time.Duration;
import java.util.List;

import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.WebDriverWait;

public class BulkScreenshots {
    public static void main(String[] args) throws Exception {
        List<String> urls = List.of(
            "https://example.com/one",
            "https://example.com/two"
        );

        Path outputDir = Paths.get("screenshots");
        Files.createDirectories(outputDir);

        WebDriver driver = new ChromeDriver();
        try {
            WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(15));

            for (int i = 0; i < urls.size(); i++) {
                String url = urls.get(i);
                Path target = outputDir.resolve(String.format("%04d.png", i + 1));

                try {
                    driver.get(url);
                    wait.until(d -> "complete".equals(
                        ((JavascriptExecutor) d).executeScript(
                            "return document.readyState")));

                    File temporary = ((TakesScreenshot) driver)
                        .getScreenshotAs(OutputType.FILE);
                    Files.copy(temporary.toPath(), target,
                        StandardCopyOption.REPLACE_EXISTING);
                    System.out.println("Saved " + url + " -> " + target);
                } catch (Exception ex) {
                    System.err.println("Failed " + url + ": " + ex.getMessage());
                }
            }
        } finally {
            driver.quit();
        }
    }
}

OutputType.FILE produces a temporary file. Selenium documents that this file is deleted when the JVM exits, so copy it immediately, as the example does. The finally block closes the browser even when setup or navigation fails.

Why the readiness check is not the whole story

document.readyState == "complete" means the document’s load process reached its complete state; it does not prove that client-rendered data, fonts, animations, or lazy images have finished. Add a condition that matches the page you are capturing, such as waiting for a known content selector:

wait.until(d -> d.findElement(
    org.openqa.selenium.By.cssSelector("main article"))
    .isDisplayed());

For pages with a known rendering delay, use an explicit wait for a selector or another observable condition rather than an arbitrary long sleep. If a page never reaches the condition, catch the timeout for that URL, log it, and continue.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 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.

File naming that survives real batches

A name based only on the URL’s last path segment can collide: different hosts may use the same path, and the same URL may appear twice. An index is the simplest collision guard. For jobs that must be reproducible across reordered input, combine a sanitized host/path slug with a short content hash, while retaining the index in a manifest that maps each output to its original URL.

Strategy Strength Trade-off
Sequential index (0001.png) Always unique within one run and easy to sort Names change if the input order changes
Sanitized URL slug Readable to a person Long or invalid filesystem characters require careful normalization
URL hash Stable for the same URL and compact Not human-readable; keep the original URL in a manifest
Index plus slug or hash Readable and collision-resistant Requires a naming helper and a manifest for complete traceability

Never use raw query strings or path separators directly in a filename. Keep a CSV or JSON manifest containing the input index, URL, output path, timestamp, and error message so the image set can be audited.

Choosing the screenshot output

The API supports three output forms. Select the form that matches where the data goes next.

Output type What you receive Use it when
OutputType.FILE A temporary File You want Selenium’s image written through a normal file copy; copy it immediately.
OutputType.BYTES Raw image bytes You will upload to object storage, compute a digest, or write with your own stream.
OutputType.BASE64 Base64-encoded image data You must embed the image in a JSON payload, HTML data URI, or another text protocol.

A bytes-based save avoids the temporary-file lifecycle:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • 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.
byte[] image = ((TakesScreenshot) driver)
    .getScreenshotAs(OutputType.BYTES);
Files.write(target, image);

For very large batches, bytes can also let you stream directly to durable storage instead of keeping temporary files. Do not retain every image in a list; process and release each result before navigating onward.

Capturing one element instead of the page

If the requirement is a component image rather than the browser view, call the same method on a WebElement. The element must be located after navigation and after the relevant content is present:

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;

WebElement chart = driver.findElement(By.cssSelector("#sales-chart"));
File temporary = chart.getScreenshotAs(OutputType.FILE);
Files.copy(temporary.toPath(), outputDir.resolve("sales-chart.png"),
    StandardCopyOption.REPLACE_EXISTING);

Element capture keeps the target narrow. It does not turn a page-level capture into a guaranteed full-document image.

Viewport versus full-page screenshots

Do not assume that every browser and driver returns a full-page image. The WebDriver specification defines screenshot behavior for conformant implementations. Selenium documents a best-effort order for non-conformant implementations that may produce the entire page, the current window, the visible portion of the current frame, or the display. The result can therefore vary by browser, driver, and version.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • 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

If full-page output is a hard requirement, validate the exact browser/driver combination used in production. Add a visual check for a page whose height is known, or inspect the resulting image dimensions, and treat an unexpected viewport-only image as a failed capture. If the page uses frames, capture the frame or switch into it deliberately; the visible portion of the current frame is one of the possible best-effort outcomes.

Making a batch reliable

Isolate each URL

Keep the navigation, wait, screenshot, and copy inside a per-URL try block. Log the URL, exception class, message, and target path. A timeout or browser error should mark one item failed, not terminate the loop.

Reset state when pages are not independent

A single driver preserves cookies, local storage, tabs, and other browser state between navigations. Reusing that session is efficient when the pages belong to one flow, but it can contaminate independent captures. Start a fresh driver for isolation-sensitive groups, or explicitly clear the state between items when that is safe for the site.

Control dynamic content

  • Wait for a selector that proves the main content exists.
  • Wait for a loading indicator to disappear when the application exposes one.
  • Use a bounded timeout so a broken URL cannot block the entire batch.
  • Capture at a consistent viewport and device scale when images will be compared.

Parallelize only with isolated drivers

Parallel workers can improve throughput, but each worker needs its own WebDriver instance, independent temporary profile, and non-overlapping output paths. WebDriver sessions are stateful; sharing one driver across threads creates navigation races and corrupts the association between URLs and files. Start with sequential capture, measure the runtime, and add a bounded worker pool only when the browser and machine have enough CPU, memory, and I/O capacity.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

Symptom Likely cause Fix
SessionNotCreatedException when constructing the driver Browser/driver incompatibility or unavailable driver binary Install a compatible browser and WebDriver, verify they are discoverable, and test a single navigation before running the batch.
Timeout waiting for readiness The page never reaches the selected condition, or the condition is too strict Capture diagnostics, verify the selector in an interactive run, and choose a condition that represents usable content with a finite timeout.
Only the visible viewport is saved The implementation did not provide a full-page screenshot Validate browser/driver conformance and support; do not label the result “full page” without checking it.
Images are blank or missing Lazy loading or client rendering had not completed Wait for the image/content selector or another page-specific signal before calling getScreenshotAs.
Later files overwrite earlier files Names are derived from a non-unique URL fragment Use a run index, or an index plus slug/hash, and keep a URL-to-file manifest.
Some URLs fail but the job stops Exception handling surrounds the whole loop Move navigation and capture handling inside the per-URL block and keep driver.quit() in the outer finally.
Copied file disappears later The temporary OutputType.FILE was retained instead of copied Copy it immediately, or request BYTES and write the bytes yourself.

Operational, performance, and cost considerations

Sequential capture is easiest to reason about and preserves a simple URL-to-output order. Its runtime includes every navigation, wait, screenshot, and file write. Reduce avoidable work by reusing one driver when shared state is acceptable, writing each image once, and avoiding unbounded waits. Parallelism trades that simplicity for higher resource use and stricter isolation requirements.

Selenium itself does not provide a hosted screenshot quota or a managed retry service in this workflow; you operate the browser, driver, machine, storage, and logging. Account for browser startup time, disk space, network transfer, and the cost of retries in your own environment. Keep failed URLs in a retry queue rather than rerunning successful captures.

Or skip the browser setup

ScreenshotNeo is a website screenshot API and MCP server for developers. One GET request returns a PNG, JPEG, WebP, or PDF. Before capture it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response reports the result through X-Page-Verdict and X-Billed headers.

The API supports full-page captures with lazy images loaded, CSS-selector element captures, dark mode, 12 device presets plus custom viewports, retina scale, PDF paper size/margins/landscape/page ranges, HTML/CSS-to-image, custom JavaScript and CSS, pre-capture clicks, selector hiding, waits for selectors/delay/network idle, request and resource blocking, custom headers/cookies/user agent/Authorization, timezone and geolocation, transparent backgrounds, resizing, configurable-TTL caching, signed public-image links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, and an OpenAPI specification. Parameter names used by other screenshot APIs also work for easier migration. Every feature is included on every plan.

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.

It also provides an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.

See the ScreenshotNeo documentation for request options. A direct call looks like this:

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

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
Plan Included shots Price
Free 1,000 per month $0, no card
Starter 3,000 $5
Growth 15,000 $15
Pro 60,000 $39
Scale 250,000 $99
Business 1,000,000 $249

Yearly billing gives two months free. The free plan includes 1,000 screenshots each month without a card, and paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account to try the API.

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.