Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
The short answer: WebDriver does not use one universal screenshot folder. The screenshot goes wherever your code’s save method points, interpreted relative to the process working directory unless you provide an absolute path. If you request bytes or Base64 instead, no image file is created until you write or decode that data yourself.
This guide shows how to locate, open, validate, and reuse screenshots in Python and Java, including local, containerized, and remote runs.
Where WebDriver actually saves a screenshot
A screenshot path is an argument to the save operation, not a WebDriver setting. For example, driver.save_screenshot("artifacts/page.png") asks Python Selenium to create artifacts/page.png under the process’s current working directory. Running the same test from a different directory can therefore produce a different absolute location.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesTo remove ambiguity, create the directory, use a known path, and print its resolved value. A relative path is convenient in a small local script; an absolute path or a path resolved from your project directory is safer in CI.
#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
Find the current working directory
from pathlib import Path
print(Path.cwd())
That directory is the base for a relative filename. The browser window itself does not determine the location.
Use a deterministic Python path
from pathlib import Path
out = Path("artifacts") / "page.png"
out.parent.mkdir(parents=True, exist_ok=True)
ok = driver.save_screenshot(str(out))
if not ok:
raise OSError(f"Could not save screenshot to {out.resolve()}")
print(f"Screenshot: {out.resolve()}")
save_screenshot saves the current window as PNG. Python Selenium also provides get_screenshot_as_file(filename) for the same path-based workflow. The documented return value is False when an I/O error prevents saving, so check it rather than assuming the file exists.
Open and read a saved PNG
After the save call succeeds, open the printed absolute path with your operating system’s image viewer or attach it to a test report. From a shell, verify that the file exists and has non-zero size:
Recommended Free Tools
from pathlib import Path
path = Path("artifacts/page.png").resolve()
print(path.exists(), path.stat().st_size if path.exists() else 0)
A valid file should contain PNG data and normally have a .png suffix. If an image viewer reports a corrupt image, first confirm that the save method returned success and that you did not write an error response or text into the file path.
Read image content in Python
For inspection or processing, open the file as binary data. An image library can then decode those bytes, or you can pass them to an artifact uploader.
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
from pathlib import Path
png_bytes = Path("artifacts/page.png").read_bytes()
print(len(png_bytes), png_bytes[:8])
The first bytes of a normal PNG begin with the PNG signature. Do not treat arbitrary response text as an image merely because the filename ends in .png.
Get screenshot data without creating a file
Python Selenium separates capture from storage. get_screenshot_as_png() returns binary PNG data; get_screenshot_as_base64() returns Base64 text. This is useful when your next step is an upload, image analysis, HTML embedding, or a test-report API rather than a local file.
Free tools Windows power users keep installed
One-click scans. No signup required.
Binary bytes
png_bytes = driver.get_screenshot_as_png()
# Write it later, if needed
with open("artifacts/later.png", "wb") as image_file:
image_file.write(png_bytes)
Base64 for HTML
import base64
encoded = driver.get_screenshot_as_base64()
html = f'<img alt="WebDriver screenshot" src="data:image/png;base64,{encoded}">'
print(html[:100])
Base64 is text, not decoded image bytes. If a consumer expects bytes, decode it first:
png_bytes = base64.b64decode(encoded)
Java: choose a file, bytes, or Base64 output
Java uses the TakesScreenshot interface and OutputType to select the representation. The driver can capture a driver window, and Selenium also supports screenshot capture from a WebElement where the implementation provides it.
Save a durable file
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
File temporary = ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.FILE);
Path destination = Path.of("artifacts", "page.png");
Files.createDirectories(destination.getParent());
Files.copy(temporary.toPath(), destination);
System.out.println(destination.toAbsolutePath());
The returned file may be temporary. Copy it to a durable destination before the temporary file is removed or the test process ends.
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.
Request other representations
byte[] pngBytes = ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.BYTES);
String base64 = ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.BASE64);
Use bytes for binary processing and Base64 when an API or HTML document requires text. A W3C-conformant driver follows the WebDriver screenshot behavior; non-conformant implementations may use browser-specific best-effort behavior. Capture scope and details can therefore differ between browsers, drivers, and versions.
What exactly is captured?
Current window versus an element
A driver screenshot normally represents the current browser window or viewport. An element screenshot targets a particular WebElement when supported. These are different from a guaranteed full-document image.
Full-page expectations
Do not assume that every WebDriver returns a full, scroll-stitched page. Full-page facilities can be browser- or driver-specific. If you require a consistent full-page result across environments, verify the behavior of the specific driver and version you run, or use a service designed to provide that capture mode.
Remote, Grid, container, and cloud runs
With Selenium Grid, a container, or a cloud browser, the process executing the browser may be a different machine from the process reading your test results. The path passed to the save API is interpreted in the execution environment. A file saved on a browser node is not automatically present on your laptop or CI controller.
- Print the resolved path from the process that calls the screenshot API.
- Check that process’s filesystem and write permissions.
- Use the Grid, container, or cloud provider’s artifact-download or file-transfer mechanism to move the PNG to the place where reports are assembled.
- If you need to avoid filesystem transfer, request bytes and upload them directly from the test process, provided that process can reach your artifact store.
There is no universal remote-file location; the execution topology and its artifact mechanism decide where you can retrieve the image.
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
File, bytes, or Base64: which should you choose?
| Need | Best form | Reason |
|---|---|---|
| Open manually or attach a conventional artifact | PNG file | Easy for viewers, CI artifacts, and bug reports. |
| Process or upload immediately | Binary bytes | No path ambiguity and no Base64 expansion. |
| Embed in an HTML report or JSON field | Base64 | Text-safe, but decode it before treating it as an image. |
| Remote execution with uncertain storage | Bytes or Base64 | Lets the test process transfer data directly instead of relying on a node’s disk. |
Troubleshooting checklist
No file appears
- Print
Path.cwd()and the resolved destination; you may be looking in the wrong directory. - Create the parent directory before saving.
- Check the Boolean result from Python’s save method.
- Verify the test process has permission to write to that location.
- In a remote run, inspect the browser node or service rather than only the local runner.
The path is correct but the viewer cannot open it
- Confirm the save call succeeded and the file size is non-zero.
- Keep the documented
.pngextension for Python path-based methods. - Check that you wrote raw PNG bytes, not Base64 text. Decode Base64 before writing binary output.
- Make sure an exception page, API error, or logging text was not redirected into the image file.
The screenshot is cropped or differs between browsers
- Determine whether you requested a viewport, element, or browser-specific full-page capture.
- Compare browser and driver versions and use a W3C-conformant implementation where possible.
- Do not generalize a full-page feature documented for one browser to every WebDriver.
The screenshot is blank or taken too early
- Wait for the page state your test actually needs, such as a visible element or completed application render, before capturing.
- Capture after navigation and interactions have finished, not immediately after starting them.
- For remote environments, also check that the page was not blocked by authentication, a bot check, or network policy.
Or skip the browser setup
ScreenshotNeo provides a one-request website screenshot API and MCP server. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Only clean shots are billed: bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP tools—take_screenshot, get_page_info, and capture_pdf—work with Claude, Cursor, and other MCP clients.
For a direct capture, see the ScreenshotNeo API documentation and run:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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}`);
ScreenshotNeo includes full-page and element capture, device and viewport controls, retina scale, PDF output, custom CSS and JavaScript, waits, request blocking, headers, cookies, user agents, authorization, timezone and geolocation, transparent backgrounds, resizing, configurable caching, signed links, asynchronous jobs, bulk capture of up to 100 URLs per call, usage reporting, and an OpenAPI specification. Parameters used by other screenshot APIs also work, which can simplify migration.
The Free plan includes 1,000 screenshots per month without a card. Paid plans start at $5 for 3,000 shots; yearly billing provides two months free, and every feature is available on every plan. Create a free ScreenshotNeo account to get started.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallOutdated 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 matchPractical reliability and cost notes
For Selenium, saving locally is straightforward but depends on the process filesystem, permissions, and artifact collection. In-memory capture reduces path issues but shifts responsibility to your upload or report code. In either case, log the capture target, resolved destination or byte count, browser and driver identity, and the test result so a failed artifact can be diagnosed.
For ScreenshotNeo, inspect the X-Page-Verdict and X-Billed response headers when building automation. They tell you whether a response was a clean capture and whether it was billed, including the no-charge failure and cache cases described above.
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.
Frequently Asked Questions
Where did Selenium save my screenshot when I used a relative filename?
It saved relative to the current working directory of the process that called the API. Print that directory and the resolved destination to find the exact location.
Can I attach a screenshot without writing a PNG first?
Yes. Python can return PNG bytes or Base64, and Java can request byte-array or Base64 output with its output type.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Why is a Java screenshot file temporary?
The file returned by the selected output mechanism may be temporary. Copy it to your intended artifact directory before the temporary file is cleaned up.
Does a WebDriver screenshot always include the entire page?
No. Driver screenshots commonly represent the current window or viewport. Full-page behavior is implementation- and browser-dependent.
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.

