What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
In Selenium Python, save the current browser window as a PNG with driver.save_screenshot("screenshot.png"). In Java, use ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE). These commands capture a Selenium-controlled browser; they are different from a screenshot API that captures a web page by URL without requiring you to set up a browser session.
The Selenium screenshot command in Python
The shortest Python command for saving the current WebDriver window is:
driver.save_screenshot("screenshot.png")
It writes a PNG image to the path you give it. Selenium also documents driver.get_screenshot_as_file("screenshot.png") as an equivalent file-saving method. Use a filename ending in .png and provide a full path when you need the output in a particular directory. The Python file method returns False if an I/O error prevents it from writing the file.
Save a screenshot and check whether it worked
For a test or automation job, check the Boolean result rather than assuming the file was created:
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errors#1 Best Overall
from pathlib import Path
output = Path("artifacts/home.png")
output.parent.mkdir(parents=True, exist_ok=True)
ok = driver.save_screenshot(str(output))
if not ok:
raise IOError(f"Screenshot could not be written: {output}")
This example assumes driver is an already-created WebDriver and that the browser is displaying the page you want to capture. Creating the parent directory prevents a missing-directory error from stopping the file write. The screenshot is of the current browser window at the time the command runs, so navigate to the target page and wait until the state you want is visible first.
Choose a file, bytes, or base64 output
Use a file when you want an artifact that can be opened or attached to a test report. If another part of your Python program will handle the image directly, Selenium also provides two in-memory forms:
png_bytes = driver.get_screenshot_as_png()
base64_image = driver.get_screenshot_as_base64()
get_screenshot_as_png()returns PNG image data as bytes.get_screenshot_as_base64()returns the PNG data as a base64-encoded string.
Neither in-memory method writes a file on its own. Save or pass the returned value to the next part of your application according to the interface that part expects.
The Selenium screenshot command in Java
In Java, a WebDriver that supports screenshots can be cast to Selenium’s TakesScreenshot interface. To get a temporary file, use OutputType.FILE:
import java.io.File;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
File screenshotFile = ((TakesScreenshot) driver)
.getScreenshotAs(OutputType.FILE);
getScreenshotAs accepts an output type. The documented choices relevant here include OutputType.FILE and OutputType.BASE64. Choose the file form when you need a file artifact; choose base64 when the receiving code expects an encoded string. The call returns a file or value to handle in your program; the Python Boolean-return behavior does not apply to this Java method. Java failures can be reported as Selenium exceptions such as WebDriverException.
Rank #2
The same TakesScreenshot interface may be implemented by a Java WebElement, so a screenshot can sometimes be requested from an element rather than the driver. Do not treat that as a universal element-cropping guarantee: Selenium describes the capture scope for non-W3C drivers as best effort and browser-dependent. If exact, consistent element imagery matters, verify the behavior with the particular browser and driver you use.
What the command captures—and what it does not
The standard Python file command captures the current WebDriver window. It is not the same as a command that guarantees an image of every pixel of a long document. If the requirement is the whole page, use a full-document method that your browser implementation supports rather than assuming the default window screenshot will include content outside the captured window.
Firefox Python full-page screenshots
Firefox’s Python WebDriver exposes separate full-document screenshot methods, including:
Free tools Windows power users keep installed
One-click scans. No signup required.
driver.save_full_page_screenshot("artifacts/full-page.png")
The related method get_full_page_screenshot_as_file is also available in Firefox Python. These are Firefox-specific methods; they are not interchangeable names for the general save_screenshot call. Use them when the requirement is a full-page document capture and your WebDriver is Firefox.
Window, element, and full-document scope
- Current window: use
driver.save_screenshot(...)in Python or the driver’sTakesScreenshotimplementation in Java. - One element: Java can request a screenshot through a
WebElementthat implementsTakesScreenshot, but non-W3C driver behavior is best effort and browser-dependent. - Full document: Firefox Python provides explicit full-page methods. The ordinary current-window command does not itself promise full-document capture.
When to take the screenshot in a test
A screenshot records the browser’s state at the moment Selenium captures it. That makes the order of operations important: navigate, wait for the meaningful state, then capture. If a test takes the screenshot before the page has finished rendering or before a relevant element appears, the resulting PNG may be technically valid but not useful for diagnosing the test.
Rank #3
For failure artifacts, put the capture in the test framework’s failure-handling path and use a path that identifies the test or run. Avoid silently discarding a failed save: check the Python return value, and handle Java exceptions so that an image-write or driver error is visible in the test output. Keep browser setup, waiting, capture, and cleanup in their appropriate parts of the test lifecycle; the screenshot call itself does not create or navigate a browser session.
Common Selenium screenshot problems
The output file is missing
In Python, first inspect the Boolean return value. A False result means an I/O error prevented saving. Check that the directory exists, that the process can write there, and that the supplied path points where you expect. Use an explicit full path when the current working directory may vary between local runs and CI jobs.
Recommended Free Tools
The image exists but shows the wrong state
The capture reflects the current window when the method runs. Confirm that navigation has reached the intended page and that your test has waited for the relevant state before calling the screenshot method. The command does not select a different tab, navigate to a URL, or wait for page content on your behalf.
The screenshot stops at the visible window
The default Python command is documented as saving a screenshot of the current window, not as a universal full-document capture. For a full page in Firefox Python, use save_full_page_screenshot or get_full_page_screenshot_as_file. For another browser or language, the supplied Selenium API details do not establish an equivalent full-page method; confirm support for the browser and driver you actually run rather than assuming the Firefox call applies.
Java throws a WebDriver exception
Java reports failures through exceptions such as WebDriverException, rather than returning the Python file method’s Boolean result. Preserve the exception in your test logs and check that the driver supports screenshot capture and that it is still usable when the call occurs. A WebElement capture can also vary by driver, so test that route against your target browser if you depend on it.
The Java file is not where the test expects it
OutputType.FILE gives your code a file value to handle. The snippet above does not choose a permanent artifact destination. If the test needs a specific output path, copy or otherwise manage the returned file using your application’s file-handling code, and make that destination explicit.
Performance, reliability, and artifact handling
A Selenium screenshot is taken through the browser session that your automation has already created. Its practical cost includes running that session and writing or transferring the image; the screenshot command is not a substitute for a browser lifecycle, page navigation, or synchronization. For reliable test artifacts, use predictable paths, avoid filename collisions between parallel tests, and ensure the process has write access. If an image is sent to a reporting service, consider whether passing bytes or base64 is more convenient than first writing a local file.
Capture only at useful checkpoints: for example, when a test fails or when a visual state is important to verify. Repeatedly saving large numbers of unnecessary images can add storage and artifact-transfer work to an automation pipeline. A screenshot also records only what that particular capture method and browser provide; do not infer full-page or element-level guarantees from the mere fact that a PNG was returned.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Or skip the browser setup
If you need a screenshot of a page by URL rather than a screenshot from an existing Selenium session, ScreenshotNeo is a website screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF. For example, this cURL request saves a WebP capture of Stripe:
curl -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 request parameters and response details. Python and Node.js equivalents are:
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 matchWindows 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 reinstallBest Value
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}`);
With ScreenshotNeo, cookie banners and consent prompts are accepted and removed before the capture, and newsletter popups and chat widgets are removed; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. Selenium remains the relevant choice when the screenshot must come from a browser session your test is already controlling; a URL-based API is an alternative when you want to request a capture without building that browser setup.
The free plan includes 1,000 screenshots per month with no card required. Paid plans start at $5 for 3,000 shots; the other monthly tiers are Starter at $5 for 3,000, Growth at $15 for 15,000, Pro at $39 for 60,000, Scale at $99 for 250,000, and Business at $249 for 1,000,000. Yearly billing gives two months free, and every feature is available on every plan. Sign up free for 1,000 screenshots a month with no card.
Quick command reference
| Need | Command or method | Result |
|---|---|---|
| Python file | driver.save_screenshot("screenshot.png") |
PNG of the current window; returns a Boolean for save success. |
| Python equivalent file method | driver.get_screenshot_as_file("screenshot.png") |
PNG file capture of the current window. |
| Python in-memory image | driver.get_screenshot_as_png() |
PNG bytes. |
| Python base64 | driver.get_screenshot_as_base64() |
Base64-encoded PNG string. |
| Java file | ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE) |
Screenshot file value. |
| Firefox Python full document | driver.save_full_page_screenshot("full-page.png") |
Firefox-specific full-page PNG capture. |
Frequently Asked Questions
Does Selenium save screenshots as JPEG by default?
The documented Python screenshot file methods save PNG images; use a filename ending in .png.
Can the Python screenshot command return image data without creating a file?
Yes. Use get_screenshot_as_png() for bytes or get_screenshot_as_base64() for a base64 string.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Is a Selenium screenshot command the same as a screenshot API request?
No. Selenium captures through a WebDriver browser session. A URL-based screenshot API accepts a page URL and returns a capture without requiring that Selenium session.
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.

