Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Repair Windows errors before they cause bigger problems3Fix the driver behind crashes, sound loss and screen glitchesTo take bulk screenshots with Selenium in Java, loop over your URLs, navigate to each page, wait for the page state your capture depends on, then call getScreenshotAs and copy its temporary output to a uniquely named file. The example below saves one PNG per URL and continues if an individual page fails. Selenium screenshots are not guaranteed to include the entire page across every browser and driver, so validate the result if you need full-page images.
What Selenium captures—and what it does not guarantee
Selenium’s Java TakesScreenshot interface provides getScreenshotAs(OutputType.X) for capturing a driver or element. With a driver, the captured area depends on the browser and WebDriver implementation. W3C-conformant implementations follow the WebDriver specification; for non-conformant implementations, Selenium documents a best-effort order that may yield the entire page, the current window, the visible portion of the current frame, or the display. Treat a driver screenshot as a browser-dependent result, not a universal full-page capture API.
If you need the entire page, test the exact browser and driver you intend to run and inspect output from long pages, pages with lazy-loaded content, and pages that scroll or change layout. If consistency across browsers matters, use an approach explicitly supported by your chosen browser and verify its output rather than assuming the driver screenshot includes content below the viewport.
Build a sequential bulk screenshot job
The straightforward approach is one WebDriver session and one screenshot operation per URL. This keeps navigation and file output in a predictable order. The following Java example creates the output directory, waits for document.readyState to become complete, copies each temporary screenshot immediately, and records failures without stopping the remaining captures.
Free tools Windows power users keep installed
One-click scans. No signup required.
import java.io.File;
import java.io.IOException;
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 IOException {
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 temp = ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.FILE);
Files.copy(temp.toPath(), target,
StandardCopyOption.REPLACE_EXISTING);
System.out.println("Saved " + url + " to " + target);
} catch (Exception e) {
System.err.println("Failed " + url + ": " + e.getMessage());
}
}
} finally {
driver.quit();
}
}
}
Prerequisites and running it
- Use a Java version that supports
List.ofandPath/Files(Java 11 is a suitable baseline for this example). - Add Selenium’s Java client library to the project and configure a compatible Chrome browser and driver for your environment. The example assumes
new ChromeDriver()can start a browser; browser and driver setup is environment-specific. - Replace the sample URLs with the pages you own or are authorized to capture. Ensure the account and network access used by the browser can reach them.
- Run the class from a location where the process can create the
screenshotsdirectory and write image files.
Each successful iteration produces a PNG named 0001.png, 0002.png, and so on. The index makes names deterministic for a fixed URL order, including when the URL list contains duplicates. The output path is relative to the process’s working directory; use an absolute Path if the job runs under a scheduler or service with a different working directory.
Why the per-URL try/catch matters
A navigation timeout, browser error, or screenshot exception on one URL should not erase useful results already produced or prevent later URLs from being attempted. This example logs the failing URL and moves to the next item. In a production job, record the exception type and full stack trace in your normal job logs, and produce a separate failure report so an incomplete batch is visible to whoever consumes it.
Choose the output type and naming scheme deliberately
FILE: copy it before the JVM exits
OutputType.FILE returns a temporary file that Selenium says is deleted when the JVM exits. Copy or move it to durable storage immediately after capture; do not save only its temporary path for a later batch-processing step. The example copies to the final destination before beginning the next navigation.
Rank #2
BYTES and BASE64
OutputType.BYTES gives you the image as a byte array, useful when your next step writes to object storage or passes the data to another component without staging a temporary screenshot file. OutputType.BASE64 returns base64-encoded image data, useful when the receiving interface expects that representation. Both avoid relying on the returned temporary file as the final artifact; you remain responsible for writing, transmitting, and handling the data correctly.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Prevent collisions when URLs repeat
A simple sequential index is collision-safe within one run, but it does not identify which URL produced a file after the input order changes. For durable batches, use an index plus a sanitized hostname or slug, or a stable hash of the URL. Keep the index even if you add a slug: two different URLs can sanitize to the same text. If multiple jobs can write to the same directory, include a job identifier or timestamp in the directory or filename, and avoid concurrent writes to the same target.
Wait for the state that matters to your screenshot
The example waits for document.readyState to report complete. That is a useful baseline, but it does not prove that every application-specific element is visible, that delayed content has rendered, or that an animation has finished. A page may keep loading data after its document reaches that state.
For a page with a known capture target, wait for that element to be present or visible before capturing. For a site whose content appears after an interaction or a delay, synchronize on that site-specific condition rather than adding an arbitrary pause to every URL. If the target can fail to appear, handle the wait timeout as a per-URL failure and decide whether that URL should be retried or reported as incomplete.
Capture one element instead of the page
When the requirement is an image of a specific element, locate the element and call getScreenshotAs on the WebElement, then copy the returned temporary file just as you would for a driver screenshot:
WebElement element = driver.findElement(By.cssSelector(".report-card"));
File temp = element.getScreenshotAs(OutputType.FILE);
Path target = outputDir.resolve("report-card.png");
Files.copy(temp.toPath(), target, StandardCopyOption.REPLACE_EXISTING);
Use an appropriate wait before locating the element if it is rendered asynchronously. Element-level capture is a different requirement from page-level capture: select the element that contains the content you need, and check the resulting image for clipping or layout changes on your target browser.
Rank #4
Sequential or parallel: choose based on isolation
A single driver processing URLs sequentially is easier to reason about: there is one browser session, output order follows input order, and a capture failure can be associated with the current URL. Its trade-off is that total job time grows with each navigation and capture.
Parallel workers can improve throughput, but only when each worker has its own isolated WebDriver session and output path. Do not share one driver across concurrent tasks: navigation and capture state belong to the active browser session, so simultaneous operations can capture the wrong page or interfere with each other. Also account for the extra browser processes, memory, and CPU used by parallel workers. Start with a modest worker count, monitor resource use and failure rates in your environment, and make output names safe across workers.
Troubleshoot common bulk-capture failures
- The browser does not start: Check that the browser and driver are installed and compatible, and that the runtime environment can launch a browser. Confirm any required headless or container configuration for your deployment.
- The output directory is empty: Check the process working directory, write permissions, and the console or application log for navigation and screenshot exceptions. Use an absolute output path when the job’s working directory is uncertain.
- A screenshot file disappears later: The returned
OutputType.FILEpath is temporary. Copy it immediately to the intended durable destination. - Only part of a long page appears: Driver screenshots are not guaranteed to be full-page across implementations. Verify behavior on the target browser and driver; do not infer full-page support from a viewport capture.
- The page image is blank or incomplete: A document-ready check may happen before application content is ready. Wait for the specific element or state that defines a usable capture, and inspect whether the page requires authentication or an interaction.
- Some URLs fail but others succeed: Keep the per-URL exception boundary, log the URL with the error, and report failed entries separately. Decide whether retries are appropriate for the specific failure instead of rerunning an entire successful batch blindly.
- Files overwrite each other: Use a unique index or content-derived identifier and isolate output paths between simultaneous jobs.
- Parallel runs capture unexpected pages: Give each worker its own driver instance; do not run concurrent navigation and screenshot calls through a shared driver.
Or skip the browser setup
If you want an HTTP call rather than managing a Selenium browser session, ScreenshotNeo returns a screenshot or PDF from a URL. Here is a cURL request for one URL; repeat it per URL or wrap it in your own batch loop. See the ScreenshotNeo API documentation for request options and response details.
Recommended Free Tools
Best Value
curl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://example.com/one
-o shot.webp
ScreenshotNeo accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the page verdict and billing status in headers. Its MCP server exposes screenshot tools to Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 screenshots.
Sign up for ScreenshotNeo’s free plan to try it without a card.
Cost, reliability, and batch operations
With Selenium, the screenshot API call itself is local to your browser session, but the batch still depends on browser startup, network access, page behavior, and the compute resources available to run the browser. A failed URL may consume time even when it produces no image. Keep a record of the URL, output path, and outcome for each iteration so you can distinguish a complete batch from a partial one.
For very large URL sets, split work into manageable chunks and persist progress as each capture finishes. That way, a process interruption does not require losing track of completed files. If you retry, avoid overwriting a valid existing image unless replacing it is intentional; alternatively, write to a temporary target and promote it only after the capture succeeds. These are job-design choices, not guarantees supplied by Selenium’s screenshot API.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Clear out junk files and repair common Windows errorsFree Scan →Frequently asked questions
Can I take screenshots of pages that require a login?
Yes, if your browser session can access them. The screenshot call captures the page state available to that session; authentication setup and permissions are specific to the site and your application.
Can one Selenium run save both screenshots and a failure report?
Yes. Add a structured success or failure record inside the per-URL loop and write those records to a CSV or JSON file after processing. Include the original URL and output path so the report can be matched to artifacts.
Quick 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.




