Recommended Free Tools
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Call Selenium’s TakesScreenshot.getScreenshotAs() each time you reach a state you want to record, then save each capture to a different filename. There is no separate multi-screenshot API: repeated calls capture the browser’s current state at each checkpoint. For file output, copy Selenium’s temporary image into your test’s artifact directory so it remains available after the JVM exits.
Capture a screenshot at each checkpoint
Selenium Java’s TakesScreenshot interface provides getScreenshotAs(OutputType) for taking a screenshot. The interface is documented for a driver or an HTML element; use the driver when you want the browser-page capture rather than an individual element. Selenium Java API: TakesScreenshot
The pattern is simple: reach a meaningful page state, save a screenshot with a distinct destination, perform the next action, wait for its result, and save again. Each call captures the state at the time it is made.
PC 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 & 11Outdated 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 matchsaveScreenshot(driver, Path.of("screenshots", "01-home.png"));
// Perform an action and wait until the resulting state is ready.
saveScreenshot(driver, Path.of("screenshots", "02-results.png"));
// Continue the test, then capture another checkpoint.
saveScreenshot(driver, Path.of("screenshots", "03-confirmation.png"));
The example uses Path.of, which is available in Java 11 and later. If your project targets an earlier Java version, use an equivalent path-construction method available in that version.
#1 Best Overall
- CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
- WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
- A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
Save each capture to a persistent file
OutputType.FILE gives you a temporary file. Selenium documents that the temporary file is deleted when the JVM exits, so copy it to the destination where you want to retain it. The following helper creates the parent directory when needed and replaces a file only if you deliberately reuse its name.
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
public final class Screenshots {
private Screenshots() {}
public static void saveScreenshot(WebDriver driver, Path destination)
throws IOException {
Path parent = destination.getParent();
if (parent != null) {
Files.createDirectories(parent);
}
File temporaryScreenshot = ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.FILE);
Files.copy(temporaryScreenshot.toPath(), destination,
StandardCopyOption.REPLACE_EXISTING);
}
}
Call it from a test after the driver has navigated to the page and after each action has reached the state you intend to document:
import java.nio.file.Path;
import org.openqa.selenium.WebDriver;
public void captureCheckpoints(WebDriver driver) throws Exception {
driver.get("https://example.com");
// Wait for the page state your test needs before capturing.
Screenshots.saveScreenshot(driver,
Path.of("target", "screenshots", "01-home.png"));
// Perform the test action and wait for its result.
Screenshots.saveScreenshot(driver,
Path.of("target", "screenshots", "02-after-action.png"));
}
This is an API-based implementation pattern; it does not prescribe how to create the driver or how to wait for a page, because those choices depend on the test and browser setup. The official Selenium example likewise captures with OutputType.FILE and copies the temporary file to a named path. Selenium documentation: TakeScreenshot
Choose filenames that preserve the test history
Distinct names prevent a later checkpoint from erasing an earlier one. A useful convention combines an ordered step number with the state being captured:
Rank #2
- CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
- 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
- SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
- INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
- THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
01-login-page.png02-validation-error.png03-account-dashboard.png
For suites that run the same test more than once, include a test-case identifier or run identifier in the directory or filename. Otherwise, a later run can overwrite files from an earlier run even when each checkpoint in one run has a unique name. Keep the extension consistent with the bytes being saved; the file output is the screenshot bytes, not an automatic format conversion step.
If overwriting is desired, StandardCopyOption.REPLACE_EXISTING makes that behavior explicit. Remove that option if an existing destination should cause a failure rather than be replaced.
Choose the output representation
Selenium Java’s OutputType defines three representations: a temporary file, raw bytes, and Base64-encoded content. Pick the form that matches how the test stores or reports its artifact. Selenium Java API: OutputType
| Output type | What you receive | When it fits | Persistence detail |
|---|---|---|---|
OutputType.FILE |
A temporary file | Copying an image into a local test-artifact directory | Copy it to a retained destination; Selenium says its temporary file is deleted when the JVM exits. |
OutputType.BYTES |
Raw image bytes | A reporting or storage API that accepts a byte array | Store or upload the returned bytes through the destination’s own mechanism. |
OutputType.BASE64 |
Base64-encoded screenshot content | A report or remote artifact interface that expects an encoded image | Keep or transmit the encoded string as required by that interface. |
For byte output, the same checkpoint pattern can pass the returned array to a test framework or artifact uploader:
Rank #3
- Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
- Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
- Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
- In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
- Ultra-thin bezels: Maximize your viewing experience with thin bezels.
byte[] image = ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.BYTES);
// Pass image to the test framework or storage layer that accepts byte[].
For Base64, use the matching output type:
String encodedImage = ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.BASE64);
// Pass encodedImage to a report or API that expects Base64 content.
Capture an element instead of the whole driver
When the evidence should be a cropped image of one element, locate that WebElement and use its screenshot method where the driver/browser combination supports it. The Java API describes screenshot capture for drivers and HTML elements, but implementations can have behavior caveats when they are not W3C-conformant. Confirm support for the particular driver and browser used by your test. For a normal page checkpoint, capture through the driver instead of cropping an element.
Wait for the state you mean to capture
A screenshot records the state present when the capture call runs. If the test takes the screenshot immediately after clicking a button, it may record the intermediate state rather than the completed result. Put the capture after the condition that defines success for the test, such as the appearance of a result or confirmation. The exact wait condition belongs to the test’s application and is not part of the screenshot API.
- Capture before an action if you need a baseline.
- Capture after the resulting state is ready if you need evidence of the outcome.
- Use separate names for before-and-after checkpoints so the sequence is apparent in the artifact directory.
Troubleshoot missing, replaced, or unexpected screenshots
The image disappears after the test process exits
If you used OutputType.FILE and kept only Selenium’s temporary path, the file may not survive the JVM’s exit. Copy it to the intended artifact path during the test, as in the helper above.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Only the last screenshot is present
Check whether each call uses the same destination. Reusing a filename with REPLACE_EXISTING intentionally replaces the earlier file. Use a distinct step name, test identifier, or run-specific directory when you need to retain every capture.
Rank #4
- CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
- SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
- MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
- KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
- INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
The screenshot shows an earlier or incomplete state
Move the call until after the test’s page-state condition is satisfied. The capture method records the current state; it does not wait for an application-specific result on the test’s behalf.
The destination cannot be written
Make sure the destination’s parent directory exists and that the test process can write there. The helper creates missing parent directories, but it cannot overcome a read-only location or insufficient permissions. Choose a writable test-artifact path and inspect any IOException rather than silently discarding it.
The cast or capture fails for a particular driver
TakesScreenshot must be supported by the driver or element implementation being used. The API notes that screenshot behavior can vary for implementations that are not W3C-conformant. Check the driver/browser combination and its supported capture behavior before relying on a capture in that environment.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Or skip the browser setup
If you need a screenshot of a public URL rather than a checkpoint from the live browser session inside your Selenium test, ScreenshotNeo provides a URL-based screenshot API. A single GET request returns a PNG, JPEG, WebP, or PDF. It is not a replacement for capturing the exact state of a browser session controlled by Selenium.
Best Value
- 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
- 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
- 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.
For example, this cURL request saves a WebP capture of a URL:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Use your ScreenshotNeo access key in place of YOUR_API_KEY. See the ScreenshotNeo API documentation for request options. Python and Node.js equivalents are:
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)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
- Cookie banners, consent dialogs, newsletter popups, and chat widgets are removed before the capture; each cleanup step can be turned off.
- Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed; response headers report the page verdict and billing status.
- An MCP server provides
take_screenshot,get_page_info, andcapture_pdftools for Claude, Cursor, and other MCP clients. - The free plan includes 1,000 shots per month without a card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan.
Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.
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 glitchesKeep the capture method aligned with the evidence you need
For repeatable test artifacts, call Selenium’s screenshot method at each intended checkpoint and save each result to a distinct, persistent destination. Use file output when copying an image into the test’s artifact folder is simplest, or bytes/Base64 when the destination accepts those forms directly. Use a URL screenshot service only when a separate URL capture meets the need; it will not reproduce a transient state held inside the Selenium-controlled browser.
Frequently Asked Questions
Does Selenium provide a method that takes several screenshots in one call?
No. Call getScreenshotAs() once at each checkpoint you want to save.
Can I take a screenshot of one element rather than the whole page?
Yes, the Java API documents screenshot capture for HTML elements as well as drivers. Support depends on the driver and browser implementation.
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.

