October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Cupertino desk5 min

How to Fix WebDriverException When Taking a Website Screenshot on Mac

A practical Selenium-on-Mac checklist for locating screenshot WebDriverExceptions, checking live browser state, diagnosing startup failures, and saving PNGs reliably.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A Selenium WebDriverException does not identify one specific screenshot problem. Find the exact line that fails: browser startup, navigation, the screenshot command, or writing the image file. Then check the session and window state, browser-driver setup if startup failed, and the destination path if capture succeeded but no file appeared.

First, locate the failing step

Save the complete traceback and identify the line that raises the exception. Selenium’s troubleshooting documentation cautions that “It is not always obvious the root cause of errors in Selenium,” and notes that a reported Selenium issue may originate in the underlying browser driver. Selenium WebDriver troubleshooting

As an Amazon Associate I earn from qualifying purchases.

  • Browser constructor fails: No WebDriver session was created. Check the browser and driver setup and the full startup error.
  • Navigation fails: The browser may have started, but the page did not reach the state your code expects. Record the exception and confirm whether navigation completed.
  • Screenshot call fails: Check that the session is still live and the current window is valid.
  • Screenshot call returns but no image is present: Inspect the save result, filename, parent directory, and write permissions.

The title alone cannot establish which of these is happening. The precise exception, Selenium and browser versions, driver version, macOS version, code, output path, and session state are needed to identify the cause.

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.

Check that the browser session and window are still valid

A screenshot command needs an active WebDriver session and a valid current browsing context. Calling driver.quit() ends the session; closing the last browser window can also invalidate commands that follow. Selenium documents invalid-session errors after session deletion and No Such Window errors when code continues to use a window that has been closed. Selenium common errors · Selenium windows and tabs

#1 Best Overall
Apple 2026 MacBook Neo 13-inch Laptop with A18 Pro chip: Built for AI and Apple Intelligence, Liquid Retina Display, 8GB Unified Memory, 256GB SSD Storage, 1080p FaceTime HD Camera; Blush
  • AN AMAZING MAC AT A SURPRISING PRICE — With an incredibly portable and durable aluminum design, up to 16 hours of battery life,* and the A18 Pro chip, MacBook Neo is ready to go wherever school takes you.
  • FOUR STUNNING COLORS. ONE DURABLE DESIGN — Choose from four beautiful colors — Silver, Blush, Citrus, or Indigo — each with a color-coordinated keyboard. And MacBook Neo is made with a durable recycled aluminum enclosure that helps it reach 60 percent recycled content by weight — the most ever in any Apple product.*
  • FLY THROUGH EVERYDAY ASSIGNMENTS — Whether you’re cramming for finals, using Apple Intelligence* to summarize class notes, creating presentations, or even playing the latest Apple Arcade game,* MacBook Neo delivers the performance and AI capabilities you need to get things done.
  • UP TO 16 HOURS OF BATTERY LIFE — MacBook Neo delivers all day battery life, so you can power through from early morning classes to late night study sessions without worrying about plugging in.
  • A VIBRANT 13-INCH DISPLAY* — The gorgeous Liquid Retina display on MacBook Neo supports 1 billion colors, so photos and videos pop and text is crisp for easy reading.
  • Check that screenshot code runs before driver.quit().
  • If your test closes a tab or window, switch to a remaining valid window handle before issuing another command.
  • Do not assume that a browser window visible on screen means the WebDriver session or selected window is still valid; use the exception and the control flow to verify where the session ended.

If Chrome will not start, check its driver setup

Apply startup checks only when the constructor, such as webdriver.Chrome(), fails before a session exists. A startup restriction is not proof of the cause when the browser has already opened and only the screenshot command fails.

Match Chrome and ChromeDriver major versions

Selenium’s Chrome documentation says Chrome and ChromeDriver major versions must match. Check the installed browser and the driver Selenium is actually using; comparing the versions of a different driver binary will not help. Selenium Chrome documentation

Rank #2
Sale
Apple 2026 MacBook Air 13-inch Laptop with M5 chip: Built for AI, 13.6-inch Liquid Retina Display, 16GB Unified Memory, 512GB SSD, 12MP Center Stage Camera, Touch ID, Wi-Fi 7; Midnight
  • BUILT FOR COLLEGE. AND BEYOND — MacBook Air with the M5 chip packs blazing speed and powerful AI capabilities into an incredibly portable design. And with up to 18 hours of battery life,* this thin and light powerhouse is ready to take on almost any major, just about anywhere.
  • TEAR THROUGH TOUGH ASSIGNMENTS — With its faster CPU and unified memory, the M5 chip delivers even more performance and fluidity across apps, making multitasking and creative workflows smooth and responsive. A powerful Neural Engine and next-generation GPU with Neural Accelerators give you a powerful platform for AI.
  • MAKE QUICK WORK OF YOUR TO-DO LIST — Apple Intelligence helps you write, express yourself, and get things done effortlessly — whether it’s for school or everyday life. With groundbreaking privacy protections, it gives you peace of mind that no one else can access your data — not even Apple.*
  • UP TO 18 HOURS OF BATTERY LIFE — MacBook Air delivers incredible battery life with amazing performance, so you can power through a full day of classes without worrying about plugging in.
  • A BRILLIANT 13.6-INCH DISPLAY* — The gorgeous Liquid Retina display on MacBook Air supports 1 billion colors, making photos and videos pop with rich contrast and sharp detail, and text appears supercrisp. So everything — from class presentations to movies to games — looks truly stunning.

Check macOS restrictions and driver execution

For session-creation failures on macOS, Selenium lists privacy settings and a missing or non-executable driver binary among possible causes. These are possibilities to investigate against the startup error, not universal fixes for screenshot exceptions. Selenium common errors

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

Use driver-location guidance only for a driver-location error

Recent Selenium versions can use Selenium Manager to obtain a driver. An explicit driver path or a driver on PATH may be appropriate when the error indicates Selenium cannot locate a driver. Changing driver paths is not a general remedy for a failure that occurs after the session is active. Selenium Manager documentation

Rank #3
Apple 2026 MacBook Neo 13-inch Laptop with A18 Pro chip: Built for AI and Apple Intelligence, Liquid Retina Display, 8GB Unified Memory, 256GB SSD Storage, 1080p FaceTime HD Camera; Indigo
  • AN AMAZING MAC AT A SURPRISING PRICE — With an incredibly portable and durable aluminum design, up to 16 hours of battery life,* and the A18 Pro chip, MacBook Neo is ready to go wherever school takes you.
  • FOUR STUNNING COLORS. ONE DURABLE DESIGN — Choose from four beautiful colors — Silver, Blush, Citrus, or Indigo — each with a color-coordinated keyboard. And MacBook Neo is made with a durable recycled aluminum enclosure that helps it reach 60 percent recycled content by weight — the most ever in any Apple product.*
  • FLY THROUGH EVERYDAY ASSIGNMENTS — Whether you’re cramming for finals, using Apple Intelligence* to summarize class notes, creating presentations, or even playing the latest Apple Arcade game,* MacBook Neo delivers the performance and AI capabilities you need to get things done.
  • UP TO 16 HOURS OF BATTERY LIFE — MacBook Neo delivers all day battery life, so you can power through from early morning classes to late night study sessions without worrying about plugging in.
  • A VIBRANT 13-INCH DISPLAY* — The gorgeous Liquid Retina display on MacBook Neo supports 1 billion colors, so photos and videos pop and text is crisp for easy reading.

Save the screenshot to a valid PNG path

Selenium’s Python API captures the current browser window. Its file methods expect a PNG filename; Selenium recommends supplying a full path and a .png extension. get_screenshot_as_file(filename) returns False on an I/O error, so check the result instead of assuming the file was written. Selenium Python WebDriver API

from pathlib import Path
from selenium import webdriver

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

driver = webdriver.Chrome()
try:
    driver.get("https://example.com")
    ok = driver.save_screenshot(str(out))
    if not ok:
        raise OSError(f"Could not save screenshot to {out}")
finally:
    driver.quit()

This pattern creates the destination directory, saves before quitting the session, and reports a failed save. If it raises at the constructor, investigate startup; if it raises at the screenshot call, investigate session and window validity; if the call returns False, investigate the path and write access.

Rank #4
Apple 2026 MacBook Neo 13-inch Laptop with A18 Pro chip: Built for AI and Apple Intelligence, Liquid Retina Display, 8GB Unified Memory, 256GB SSD Storage, 1080p FaceTime HD Camera; Citrus
  • AN AMAZING MAC AT A SURPRISING PRICE — With an incredibly portable and durable aluminum design, up to 16 hours of battery life,* and the A18 Pro chip, MacBook Neo is ready to go wherever school takes you.
  • FOUR STUNNING COLORS. ONE DURABLE DESIGN — Choose from four beautiful colors — Silver, Blush, Citrus, or Indigo — each with a color-coordinated keyboard. And MacBook Neo is made with a durable recycled aluminum enclosure that helps it reach 60 percent recycled content by weight — the most ever in any Apple product.*
  • FLY THROUGH EVERYDAY ASSIGNMENTS — Whether you’re cramming for finals, using Apple Intelligence* to summarize class notes, creating presentations, or even playing the latest Apple Arcade game,* MacBook Neo delivers the performance and AI capabilities you need to get things done.
  • UP TO 16 HOURS OF BATTERY LIFE — MacBook Neo delivers all day battery life, so you can power through from early morning classes to late night study sessions without worrying about plugging in.
  • A VIBRANT 13-INCH DISPLAY* — The gorgeous Liquid Retina display on MacBook Neo supports 1 billion colors, so photos and videos pop and text is crisp for easy reading.

Separate capture from file writing

When you need to distinguish browser capture from filesystem handling, retrieve the screenshot as bytes and write them yourself. Selenium also provides a base64-string method. These alternatives help isolate the stage; they do not fix an invalid session or window.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
png_bytes = driver.get_screenshot_as_png()
out.write_bytes(png_bytes)
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Reduce the failure to a useful reproduction

If the exception persists, make a small script that opens a known page and captures it without unrelated test steps. Keep these details with the traceback:

Best Value
Sale
Apple 2026 MacBook Pro Laptop with Apple M5 Pro chip with 18-core CPU and 20-core GPU: Built for AI, 16.2-inch Liquid Retina XDR Display, 24GB Unified Memory, 1TB SSD, Wi-Fi 7; Space Black
  • FAST RUNS IN THE FAMILY — The 16-inch MacBook Pro with the M5 Pro or M5 Max chip brings next-generation speed and powerful on-device AI to personal, professional, and creative tasks. With all-day battery life, double the starting storage,* and a breathtaking Liquid Retina XDR display, it’s pro in every way.*
  • BUCKLE UP — Along with a next-generation CPU, faster unified memory, and up to 2x faster SSD storage,* M5 Pro and M5 Max feature a more powerful GPU with a Neural Accelerator built into each core, delivering faster AI performance and on-device training capabilities. So you can blaze through demanding workloads at mind-bending speeds.
  • BUILT FOR AI — Apple silicon, and every major component that powers it, is designed to run demanding on-device AI workloads like LLM inference and training. And Apple Intelligence helps you write, express yourself, and get things done effortlessly with groundbreaking privacy protections at every step.*
  • ALL-DAY BATTERY LIFE — MacBook Pro delivers the same exceptional performance whether it’s running on battery or plugged in.*
  • MACOS RUNS APPS FAST — All your go-to apps run lightning fast in macOS, including built-in apps like FaceTime and Messages. Plus, built-in virus protection and free software updates help keep your Mac running smoothly and securely.
  • the exact exception text and the line that raises;
  • Selenium, macOS, browser, and browser-driver versions;
  • the browser and screenshot method used;
  • whether browser construction and navigation succeeded;
  • the current window state and whether any code called close() or quit();
  • the full output path and whether the parent directory exists and is writable.

Where practical, compare another browser supported by your Selenium setup. If the same minimal workflow fails only with one browser, that comparison can help isolate an underlying driver issue; it does not by itself prove the root cause. Selenium WebDriver troubleshooting

Or skip the browser setup

If you need a screenshot without managing a local browser and driver, ScreenshotNeo offers a website screenshot API. A GET request can return a PNG, JPEG, WebP, or PDF. See the ScreenshotNeo API documentation for request options.

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp

ScreenshotNeo removes cookie and consent banners, newsletter popups, and chat widgets before capture; each cleanup step can be turned off. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, with verdict and billing details in response headers. Its MCP server provides screenshot tools for AI agents and MCP clients. The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots.

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

Sign up for ScreenshotNeo’s free plan.

Common failure patterns and next checks

What you observe Where to investigate
Exception at webdriver.Chrome() Read the startup error; check Chrome/ChromeDriver major-version alignment, macOS restrictions, and whether the driver can be found and executed.
Invalid-session error at screenshot time Look for an earlier quit() or session deletion and move capture earlier in the test flow.
No Such Window after closing a tab Switch to a remaining valid window handle before taking another screenshot.
Screenshot returns False or the file is absent Use a full PNG path, create the parent directory, verify write access, and check the method’s return value.
Failure remains unclear Reproduce with a minimal page and preserve the complete traceback and environment details; compare another supported browser where practical.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.