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 screenshot command on the RemoteWebDriver session, then save or transmit the image from the test client. The browser node performs the capture, but the file path you specify belongs to the machine running your test code—not automatically to the remote node. In Java, request OutputType.FILE and copy the temporary file; in Python, use a screenshot file method or keep the PNG bytes in memory.
How remote screenshots work
A remote session does not require a special screenshot API. The client sends the WebDriver screenshot command to the remote browser, which captures the current browser state and returns image data. The client library turns that response into a file, bytes, or a base64 string, depending on the output method you request.
This distinction matters when diagnosing where an image went: a destination such as /absolute/path/artifacts/remote-login.png is interpreted by the process running your test. If the test runner and Selenium node are separate machines, saving a screenshot on the runner does not place a file in the node’s filesystem. To store it elsewhere, write it on the runner and then upload or copy it through a separate mechanism.
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 & 11Java’s TakesScreenshot API describes a driver or HTML element that can capture a screenshot and store it in different ways. The OutputType API defines the requested representation. For Python, see the Remote WebDriver API reference.
#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
Capture and save a screenshot in Java
Cast the driver to TakesScreenshot, request OutputType.FILE, and copy the returned temporary file to a destination on the client. Create the destination directory first so that the copy does not fail because the parent folder is missing.
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.remote.RemoteWebDriver;
// hubUrl and capabilities must already be configured for your Selenium server.
WebDriver driver = new RemoteWebDriver(hubUrl, capabilities);
try {
driver.get("https://example.com/login");
// Add an explicit wait here for the page state you intend to capture.
File temporary = ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.FILE);
Path destination = Path.of("artifacts", "remote-login.png");
Files.createDirectories(destination.getParent());
Files.copy(temporary.toPath(), destination,
StandardCopyOption.REPLACE_EXISTING);
} finally {
driver.quit();
}
getScreenshotAs captures the screenshot in the requested output form; its API documents WebDriverException as a possible failure. The file returned for OutputType.FILE is temporary. Copy it promptly rather than treating its temporary location as a durable artifact. The destination in this example is relative to the test process’s working directory; use an absolute Path if the artifact location needs to be unambiguous.
When Java should use BASE64 or bytes
If the next step is to attach an image to a test report, upload it to object storage, or send it to another service, an in-memory representation can avoid an extra file-copy step. Use OutputType.BASE64 when the receiving interface expects a base64 string, or a byte-oriented output when it accepts binary data. Choose FILE when you need a local artifact that can be inspected or picked up by another process. These output forms change how the client handles the returned image; they do not change which browser state is captured.
Free tools Windows power users keep installed
One-click scans. No signup required.
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
Capture a screenshot in Python
The Python WebDriver API offers file, PNG-byte, and base64 methods. The file methods save the current window as a PNG; give them an absolute path on the client runner and ensure the parent directory exists and is writable.
from pathlib import Path
from selenium import webdriver
# driver is an already-created Remote WebDriver session.
output = Path("/absolute/path/artifacts/remote-login.png")
output.parent.mkdir(parents=True, exist_ok=True)
saved = driver.get_screenshot_as_file(str(output))
if not saved:
raise OSError(f"Could not save screenshot to {output}")
# Alternative file method:
# driver.save_screenshot(str(output))
# In-memory forms, useful for attaching or uploading without a local PNG:
png_bytes = driver.get_screenshot_as_png()
base64_png = driver.get_screenshot_as_base64()
The API reference documents get_screenshot_as_file as saving the current window to a PNG image file and returning False on I/O failure. Check that result rather than assuming a missing artifact means the browser failed to capture. Use get_screenshot_as_png() when the consumer accepts PNG bytes, or get_screenshot_as_base64() when it expects base64 text.
Choose a screenshot output that fits the next step
| Method | Best fit | Important handling detail |
|---|---|---|
Java OutputType.FILE |
A persistent test artifact or local review | Copy the returned temporary file to the intended client-side destination. |
| Java base64 or bytes | Passing image data directly to a report, API, or storage client | Keep the image in memory and encode or upload it in the form the next service accepts. |
| Python file method | A PNG artifact on the test runner | Use a full writable path; check the boolean return from get_screenshot_as_file. |
| Python PNG bytes or base64 | Embedding or uploading without first writing a file | Pass binary data or the encoded string according to the receiving interface. |
What area of the page does it capture?
Treat the basic RemoteWebDriver screenshot call as a capture of the current browser window or viewport unless the chosen browser and driver explicitly support more. Do not assume that the standard command will scroll and stitch an entire long page into a full-page image. The W3C WebDriver specification defines the conforming behavior; Selenium’s TakesScreenshot API documentation also describes a best-effort order for non-conformant drivers, ranging from the entire page through the current window and visible frame to the display containing the browser. That fallback is not a promise that every RemoteWebDriver setup produces a full-page capture.
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.
If full-page coverage is a requirement, verify the capability with the specific browser and driver you deploy, and test pages whose content extends below the viewport. Browser-specific methods may behave differently, so keep that implementation separate from portable WebDriver screenshot code. For an element-level capture, Selenium implementations may expose screenshot support on a WebElement; availability remains driver-dependent.
Recommended Free Tools
Capture the intended state, not just a page load
The screenshot command records the session’s state at the moment it runs. A successful command can therefore produce an image that is technically valid but too early, from the wrong tab, or from the wrong frame. Put navigation, waits, and context changes before the capture.
- Navigate to the target URL.
- Wait for a meaningful condition, such as a specific element becoming visible, rather than relying on an arbitrary assumption that the page is ready.
- If the target content is inside another frame or window, switch to that context before taking the screenshot.
- Capture the image, then save or transmit it from the client process.
For a page whose content changes after initial navigation, choose a wait condition that reflects the content you need to preserve. A screenshot command does not itself guarantee that animations, asynchronous data, or lazy content have settled.
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
Troubleshoot missing or incorrect screenshots
- The screenshot call throws an unsupported-operation or WebDriver error. Confirm that the active browser driver and remote session support the screenshot command. Selenium documents that capture can fail with a
WebDriverException; support can depend on the implementation. - The expected file is missing in the node container. The client-side file method writes on the test runner. Save there first, then upload or copy the artifact to the node or another storage location if needed.
- Python returns
False, or saving raises an I/O error. Check that the destination is absolute, the parent directory exists, and the test process can write to it. Check the return fromget_screenshot_as_file. - Java’s screenshot file disappears or cannot be found later. Treat the
OutputType.FILEresult as temporary and copy it to your artifact directory immediately. - The screenshot is blank, incomplete, or shows the wrong content. Verify the current session, window and frame; wait for the intended page state before capture. The screenshot reflects the browser state at command time.
- A full-page image contains only the viewport. The basic command does not guarantee a stitched full-page result. Verify that the selected browser and driver explicitly support the required full-page behavior.
Or skip the browser setup
If you need a screenshot of a public URL rather than the state of an existing Selenium session, ScreenshotNeo offers a one-request screenshot API. It is not a replacement for capturing a logged-in Selenium session or a page state created by your test; it captures a URL through its own browser workflow.
For example, this cURL request saves a WebP screenshot:
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minutecurl -G "https://api.screenshotneo.com/v1/shot"
-d access_key=YOUR_API_KEY
--data-urlencode url=https://stripe.com
-o shot.webp
See the ScreenshotNeo API documentation for parameters and formats. Equivalent Python and Node.js examples are:
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.
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 and consent banners, newsletter popups, and chat widgets can be removed before capture; each cleanup step can be turned off.
- Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed. Responses include
X-Page-VerdictandX-Billedheaders. - An MCP server provides
take_screenshot,get_page_info, andcapture_pdftools for AI agents and 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 1,000 screenshots a month without a card.
Frequently Asked Questions
Can I capture an image from a RemoteWebDriver session without saving it to disk?
Yes. Use an in-memory bytes or base64 output so your test can pass the image to another component directly.
Does a Selenium screenshot include the browser chrome and operating-system desktop?
Do not assume it does. The standard use described here is a browser window or viewport capture; the exact behavior follows the driver’s screenshot implementation.
Can I use a screenshot of a Selenium page as proof that the whole test passed?
No. It records visual state only. Preserve test assertions, logs, and other diagnostics separately.
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.

