Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

If Selenium does not create a screenshot, first check what failed: browser capture, writing the PNG file, or page rendering. save_screenshot() and get_screenshot_as_file() capture the current window and return False when a file I/O error occurs. Use an absolute writable path, create its parent directory, and test capture separately with get_screenshot_as_png(). That quickly distinguishes a filesystem problem from a WebDriver or page-state problem.

What Selenium’s screenshot methods do

Selenium’s Python API distinguishes between capturing the current window and saving the resulting image. The file methods save a PNG and expect a full path ending in .png. SeleniumHQ’s Python API documentation, version 4.49.0, describes save_screenshot(filename) as saving the current window and says it returns False for an I/O error. A false result therefore points first to output handling; it does not by itself show that the browser failed to render the page.

The Python implementation makes the distinction concrete: it gets PNG bytes, opens the requested filename in binary-write mode, and writes those bytes. It returns False on an OSError; save_screenshot() delegates to get_screenshot_as_file(). A missing directory, unwritable destination, or unavailable mounted volume can break this ordinary file write even if the browser produced the image.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Method Result Scope Filesystem needed?
save_screenshot(path) Boolean success value Current window Yes
get_screenshot_as_file(path) Boolean success value Current window Yes
get_screenshot_as_png() PNG binary bytes Current window No, unless you later write the bytes
get_screenshot_as_base64() Base64-encoded screenshot Current window No
Firefox get_full_page_screenshot_as_file() or save_full_page_screenshot() Screenshot file Full document Yes for the file method

The ordinary screenshot methods are viewport captures, not promises to capture the whole document. Firefox has separate documented full-page methods. If you need a full document in another browser, choose a browser-appropriate strategy and verify its behavior in that browser rather than treating a viewport capture as full-page.

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • 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

Diagnose the failure in order

  1. Record the result and exact destination. Store the return value from the file method, log the path (preferably its resolved absolute form), and keep the original exception and stack trace if WebDriver raises one. Do not treat False and a WebDriver exception as interchangeable: one is a reported file-output failure, while an exception may mean the capture command itself could not complete.
  2. Make the destination unambiguous. Use an absolute path, include the .png suffix, create the parent directory before capture, and confirm the account running the test can write to that directory. Relative paths depend on the process working directory, which may differ between a local run, test runner, container, or CI job.
  3. Test capture without disk access. Call get_screenshot_as_png() and inspect whether it returns bytes. If it does, WebDriver produced image data; investigate the path, permissions, mounted storage, or subsequent file handling. If the call raises an exception or returns empty data, investigate the browser session, selected window, and page state instead.
  4. Confirm the session and window are valid. Take the screenshot while the WebDriver session is alive and attached to the intended browser window or tab. A closed session, crashed driver, or invalid window handle can prevent capture before file writing begins. Preserve the original WebDriver exception; its context is more useful than replacing it with a generic “screenshot failed” message.
  5. Check whether the requirement is viewport or full document. A normal save_screenshot() captures the current window. If you need a full-page image and are using Firefox, use its documented full-page methods. For other browsers, select an appropriate strategy and account for browser-specific limitations.
  6. Check page readiness separately. Wait for navigation and the content you need before capturing. A screenshot file can be successfully written but still be blank or incomplete if the page has not rendered the relevant content. That is a timing or page-state issue, not necessarily a save-path failure.

Python: isolate capture from the file write

This diagnostic assumes driver is an active Selenium WebDriver session already pointed at the page you want. It creates the output directory, obtains PNG bytes in memory, and writes them explicitly so the capture and filesystem stages can be tested independently.

from pathlib import Path

out = Path("artifacts") / "page.png"
out.parent.mkdir(parents=True, exist_ok=True)

png = driver.get_screenshot_as_png()  # isolates WebDriver capture
if not png:
    raise RuntimeError("WebDriver returned empty screenshot bytes")
out.write_bytes(png)                  # isolates filesystem write

print(f"Saved {len(png)} bytes to {out.resolve()}")

If the byte call succeeds but write_bytes() fails, focus on the destination and the operating environment. If the byte call itself fails, record the WebDriver exception and check the session and window before changing filesystem permissions.

Direct file-save check

For a direct save, create the directory first and inspect the boolean result. The check turns a silent false return into a useful error that includes the destination.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • 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

out = Path("artifacts") / "page.png"
out.parent.mkdir(parents=True, exist_ok=True)

ok = driver.save_screenshot(str(out))
if not ok:
    raise IOError(f"Selenium could not write screenshot to {out.resolve()}")

If the method raises a WebDriver exception, let the exception remain visible in the test log or catch it only to add context and then re-raise it. Do not convert every failure into False; doing so hides whether Selenium reported an output problem or the browser command failed.

Blank, incomplete, or wrong screenshots

Blank image

First verify that the correct browser window is selected and that navigation has completed. Then wait for the specific content that should appear before capturing. A valid PNG only proves that an image was saved; it does not prove the page had finished rendering or that the intended tab was active.

Missing content or a partial page

Check the page state and capture timing, including whether the element you need has appeared. If your requirement is the entire document rather than the visible window, use a full-page method appropriate to the browser. Firefox’s dedicated full-page calls are distinct from its ordinary current-window capture; do not assume the standard file methods expand to document height.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • 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.

File is absent despite no obvious test failure

Inspect the boolean return, the process working directory, and the resolved output path. Confirm the test process can write to the parent directory and that any container or CI mount is available at the time of the run. Creating a directory on the host does not help if the process writes in a different environment or uses a different path.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common errors and fixes

Symptom Likely layer What to check
save_screenshot() returns False File output Use an absolute .png path, create the parent directory, and check write permission and storage availability.
PNG bytes are returned but the file is not created Filesystem or later file handling Write the bytes to a known writable location and inspect any exception from the write.
PNG capture raises a WebDriver exception Session or browser command Check that the session is alive, the driver has not crashed, and the selected window handle is valid.
The file exists but is blank or incomplete Page readiness or capture scope Wait for navigation and required content; confirm whether you need viewport or full-document capture.
The image shows a different page or tab Window selection Switch to the intended window or tab before capture and verify that it remains open.
Full page is cut off Capture scope Use a browser-appropriate full-page approach; ordinary Selenium file methods capture the current window.

Choosing a screenshot output method

Pick the method based on where the image needs to go and what diagnostic signal you need. File methods are direct for artifacts, but depend on a writable destination and report I/O problems with a boolean. In-memory bytes avoid disk during capture and make the browser-versus-filesystem boundary easier to test. Base64 is useful when the receiving interface expects an encoded string, such as an embedding workflow, but it is not a different capture scope: it still represents the current window.

None of these return forms automatically makes a standard Selenium capture full-page. Output format and capture scope are separate decisions: choose file, bytes, or base64 for how to handle the image, and choose an appropriate browser-supported method for how much of the page to capture.

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • 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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If the goal is to capture a website rather than exercise Selenium as part of a browser test, ScreenshotNeo offers a screenshot API and MCP server. One GET request can return a PNG, JPEG, WebP, or PDF. Its clean-shot steps can accept a consent banner and remove more than 60 known consent platforms, newsletter popups, and chat widgets; each step can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses include X-Page-Verdict and X-Billed headers.

For a basic capture, replace the example URL with the page you need and supply your API key. The API supports familiar screenshot parameter names for easier switching. See the ScreenshotNeo API documentation for request options.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python equivalent:

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)

Node.js equivalent:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

Beyond a basic shot, options include full-page capture with lazy images loaded, a CSS-selected element, dark mode, device presets or a custom viewport, retina scale, PDF settings, custom CSS or JavaScript, clicks and waits, hiding selectors, blocking ads or resource types, custom headers and cookies, timezone and geolocation, transparent backgrounds, resizing, cache TTL, signed image links, asynchronous jobs, bulk capture of up to 100 URLs per call, and a usage API. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf 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. All features are on every plan. Sign up for ScreenshotNeo’s free plan to get 1,000 screenshots a month with no card.

Best Value
Sale
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【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.

Reliability and cost considerations

For Selenium, reliable captures depend on both a working browser session and a writable output destination. Keeping those steps separate makes failures easier to localize and helps avoid reporting a page-rendering issue when the actual problem is a file path. Capture after the content you need is ready, and retain the original error details so intermittent session or storage problems can be diagnosed from logs.

No authoritative failure-rate or performance benchmark is established here, so there is no sound basis for quoting a general Selenium screenshot failure percentage or speed comparison. For ScreenshotNeo, billing is tied to the response verdict: failed loads, bot checks, blank pages, timeouts, and cache hits are not charged, with the response headers identifying verdict and billing status. Selenium’s own method return value addresses file I/O success, not a service bill or whether the page content was complete.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Frequently Asked Questions

Can I embed a Selenium screenshot without saving a PNG file first?

Yes. Use get_screenshot_as_base64() when the destination expects base64 data, or get_screenshot_as_png() when it accepts binary PNG bytes.

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.