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

If Selenium says a screenshot is unavailable, first determine whether capture failed or the image could not be written. Capture PNG bytes in memory, verify the active browser window and page state, then test an absolute writable .png path. In Python, save_screenshot() returning False specifically indicates an IOError while saving; it does not by itself prove that the browser failed to render an image.

What “image unavailable” usually means

Selenium screenshots are taken from the current browsing context: the selected window or tab, its current page, and the active WebDriver session. A closed driver, wrong tab, unfinished navigation, or a driver exception can prevent capture. A separate class of failures occurs after capture, when the binding cannot create or write the destination file.

Use this diagnostic split:

Layer Typical symptom What to test
Browser/session WebDriverException, empty image data, wrong page, or stale window Capture PNG bytes or Base64 directly; verify the session and current window
Filesystem Python returns False from save_screenshot() or get_screenshot_as_file() Use an absolute writable path ending in .png; check the directory and permissions
Page state Blank, clipped, or missing element image Wait for navigation/rendering, locate the intended element, and set a deterministic viewport

Run a minimal Python diagnostic first

This separates browser capture from file output and gives a reproducible failure point.

from pathlib import Path
from selenium import webdriver

out = Path("/tmp/selenium-shot.png").resolve()
driver = webdriver.Chrome()
try:
    driver.set_window_size(1280, 900)
    driver.get("https://example.com")

    # Test capture without touching the filesystem.
    png_bytes = driver.get_screenshot_as_png()
    if not png_bytes:
        raise RuntimeError("Driver returned no PNG bytes")

    # Test Selenium's file writer and its explicit success result.
    if not driver.save_screenshot(str(out)):
        raise RuntimeError(f"Screenshot write failed: {out}")
    print(out)
finally:
    driver.quit()

get_screenshot_as_png() returns binary image data. The file methods write PNG output and return False when an IOError occurs. Always quit the driver in a finally block so later tests do not inherit a broken session.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
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

Fix the session and browsing context

Confirm the driver is still alive

Call the screenshot before driver.quit() or driver.close(). If your test opens multiple tabs, switch explicitly to the intended handle:

driver.switch_to.window(driver.window_handles[-1])
print(driver.current_url)
image = driver.get_screenshot_as_png()

A screenshot command applies to the current window. A stale or unintended context can produce the wrong image or a WebDriver exception.

Wait for navigation and rendering

Do not capture immediately after starting navigation when the page is still being replaced. Wait for a meaningful element, document-ready condition, or application-specific state. For dynamic pages, an explicit wait is safer than a fixed sleep:

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait

WebDriverWait(driver, 20).until(
    lambda d: d.find_element(By.CSS_SELECTOR, "main").is_displayed()
)
driver.save_screenshot("/absolute/path/page.png")

If the page uses an iframe, switch into the correct frame before finding an element inside it; switch back with driver.switch_to.default_content() when appropriate.

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

Fix paths, extensions, and permissions

Use an absolute, writable PNG path

Relative paths depend on the process working directory, which may differ under CI, an IDE, or a service account. Create the directory first and keep the .png suffix:

from pathlib import Path

folder = Path("artifacts").resolve()
folder.mkdir(parents=True, exist_ok=True)
out = folder / "checkout.png"
if not driver.get_screenshot_as_file(str(out)):
    raise OSError(f"Selenium could not write {out}")
  • Check that the parent directory exists.
  • Check write permission for the user running the test, not just your interactive account.
  • Avoid a directory path, a read-only mount, or a filename without .png.
  • In containers, write to a mounted artifact directory and copy the file out after the run.

Write captured bytes yourself

If in-memory capture succeeds but Selenium’s file method returns False, the browser side is working. Write the bytes with normal file APIs and inspect the resulting file size:

png = driver.get_screenshot_as_png()
if len(png) < 100:
    raise RuntimeError("Unexpectedly small PNG response")
Path("/absolute/path/manual.png").write_bytes(png)

Chromium drivers also expose PNG-byte and Base64 forms. These alternatives help identify whether the failure is in rendering or in filesystem handling.

Capture an element reliably

Element screenshots are best effort for the element's full content or visible portion, depending on the driver. Locate the element after rendering, verify its selector, and ensure it has a nonzero displayed size:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait

def visible_box(d):
    el = d.find_element(By.CSS_SELECTOR, "#invoice")
    return el if el.is_displayed() and el.size["width"] and el.size["height"] else False

invoice = WebDriverWait(driver, 20).until(visible_box)
invoice.screenshot("/absolute/path/invoice.png")

An off-screen, detached, zero-size, or not-yet-rendered element can result in a blank or unusable image; that diagnosis follows from the API's element scope and is not a guaranteed driver error message. Scroll the element into view if the driver captures only visible content:

driver.execute_script("arguments[0].scrollIntoView({block: 'center'});", invoice)
invoice.screenshot("/absolute/path/invoice-visible.png")

Choose viewport or full-document capture

A normal driver screenshot represents the current window or viewport. Set a known size before navigation so responsive breakpoints and clipping are repeatable:

driver.set_window_size(1440, 1000)
driver.get("https://example.com")
driver.save_screenshot("/absolute/path/viewport.png")

When the requirement is the entire document, use a browser-supported full-page method rather than assuming a viewport screenshot will include content below the fold. Firefox's Python API documents:

driver.get_full_page_screenshot_as_file("/absolute/path/full-page.png")

Full-page support and behavior vary by browser and driver. If a page relies on lazy loading, scroll through it or trigger the content before capture, then allow images and fonts to finish loading.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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

Java: separate capture from copying

Java's TakesScreenshot contract allows a WebDriverException when capture fails and treats driver and element screenshots as best effort. Capture to a temporary file, then copy it to a known absolute destination:

File screenshotFile = ((TakesScreenshot) driver)
    .getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(screenshotFile, new File("/absolute/path/shot.png"));

Catch the WebDriver exception around getScreenshotAs to report a browser/session failure separately from an IOException raised while copying.

Common symptoms and targeted fixes

Symptom Likely cause Action
save_screenshot() is False Python encountered an IOError Use an absolute writable path, create the directory, retain .png, and try writing PNG bytes manually
WebDriverException Driver closed, invalid session, unsupported command, or browser failure Check session lifetime, browser-driver compatibility, current window, and logs; retry with a fresh driver
Correct file, blank page Capture occurred before navigation or app rendering completed Wait for a visible application element and inspect current_url before capture
Wrong tab or page Current browsing context is not the intended one Switch using window_handles and verify the URL
Element image is blank or clipped Element is hidden, zero-size, detached, or outside the captured region Wait for visibility, verify dimensions, scroll into view, and capture after layout settles
Only the visible top portion appears Viewport screenshot used for a full-document requirement Use a supported full-page API or a browser-specific full-page strategy

Make captures reliable in CI

  • Pin browser and driver versions that are compatible with each other.
  • Set the window size explicitly; screen resolution affects web-app rendering.
  • Use deterministic waits for the content that must appear, not arbitrary sleeps alone.
  • Save artifacts to a known writable directory and print the resolved path.
  • Record the browser, driver, URL, window handle, viewport size, and exception type with failures.
  • Retry only transient session or navigation failures; do not hide a persistent permission or selector error with retries.

For large suites, capture only on failure or at defined checkpoints. PNG is lossless but can be large; keep retention and artifact-upload limits in mind. A successful HTTP navigation does not guarantee that an application has finished rendering its dynamic content.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

ScreenshotNeo provides a single HTTP request for PNG, JPEG, WebP, or PDF output. Before capture it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and the response identifies the result with X-Page-Verdict and X-Billed headers.

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

Basic cURL call (see the ScreenshotNeo API documentation):

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.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
if (!res.ok) throw new Error(`Screenshot failed: ${res.status}`);
const fs = await import('node:fs/promises');
await fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer()));

ScreenshotNeo also offers full-page capture with lazy images loaded, element selectors, dark mode, device presets and custom viewports, retina scale, PDF page controls, custom CSS and JavaScript, click and wait actions, request/resource blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, selectable-TTL caching, signed image links, asynchronous webhooks, bulk capture for up to 100 URLs per call, usage data, and an OpenAPI specification. 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 shots each month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan, and annual billing provides two months free. Create a free ScreenshotNeo account to try it without a card.

Short FAQ

Why does Selenium return a Boolean instead of an image?

The Python file-saving methods return success status. Use get_screenshot_as_png() when your code needs image bytes rather than a filesystem result.

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

Can a screenshot prove the page is fully loaded?

No. It records the rendered state at one instant. Wait for the specific content your test requires, especially on JavaScript-heavy pages.

Should I use Base64 or PNG bytes?

Both avoid an immediate filesystem write. PNG bytes are convenient for direct file or HTTP handling; Base64 is useful when a text transport is required.

Why is a full-page screenshot different across browsers?

Full-document capture is driver- and browser-dependent. Use a documented full-page method for the browser under test and validate the output dimensions.

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.

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