Free tools Windows power users keep installed
One-click scans. No signup required.
If Selenium will not create a screenshot, first separate capture from file writing: use an absolute .png path, check the Boolean returned by save_screenshot(), and verify that a non-empty file exists. If the image is blank, clipped, or stale, debug browser state and screenshot scope separately. PhantomJS adds a maintenance problem because its development is suspended and Selenium has deprecated it; move the same test to headless Chrome or Firefox.
What Selenium’s screenshot methods actually guarantee
Selenium’s Python WebDriver API documents three useful forms:
driver.save_screenshot(path)writes the current window as a PNG and returnsTrueon success orFalsewhen file I/O fails.driver.get_screenshot_as_file(path)is an equivalent file-saving interface.driver.get_screenshot_as_png()returns PNG bytes, whiledriver.get_screenshot_as_base64()returns a Base64 representation.
The API recommends a full path ending in .png. A True result confirms that Selenium reported a successful write; it does not prove that the page was ready, that the image contains the expected content, or that you captured the required area. See the Selenium Python WebDriver API.
Use a known-good Python capture pattern
This example creates its output directory, runs a supported headless browser, checks the return value, and rejects a missing or empty artifact.
#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
from pathlib import Path
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
out = Path("/absolute/path/to/artifacts/page.png")
out.parent.mkdir(parents=True, exist_ok=True)
options = Options()
options.add_argument("--headless")
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com")
ok = driver.save_screenshot(str(out))
if not ok:
raise RuntimeError("WebDriver reported a screenshot I/O failure")
if not out.exists() or out.stat().st_size == 0:
raise RuntimeError(f"Screenshot is missing or empty: {out}")
print(f"Saved {out} ({out.stat().st_size} bytes)")
finally:
driver.quit()
The current Selenium Python documentation lists Chrome and Firefox among supported browsers. Install the browser and its matching driver according to your platform and Selenium version; the snippet is a pattern, not a compatibility matrix. The current Python client documentation is the reference for supported drivers and options.
Diagnose “save_screenshot returns False”
1. Log and act on the Boolean
Do not ignore the return value. A false result means Selenium encountered a file I/O problem while saving. Raise an error or fail the test immediately so a later step cannot mistake a missing artifact for a browser failure.
2. Replace relative paths with absolute paths
Relative paths depend on the process working directory, which may differ between a terminal, an IDE, a CI runner, and a container. Print the resolved path and use a parent directory that already exists or that your code creates.
from pathlib import Path
out = Path("artifacts") / "home.png"
out = out.resolve()
out.parent.mkdir(parents=True, exist_ok=True)
print("Writing to:", out)
assert out.parent.is_dir()
3. Check permissions, ownership, and disk space
The account running Python must be able to create and write the file. In CI or a container, a directory that is writable on your workstation may be read-only. Check directory permissions, container volume mounts, quotas, and available disk space. Also make sure a directory was not supplied where a file path is expected.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →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
4. Keep the PNG suffix
Use a filename such as page.png. The documented helper is intended to save PNG output; an unusual extension can confuse downstream artifact handling even when the browser call itself succeeds.
5. Test bytes independently of the filesystem
If the file helper fails, ask WebDriver for bytes and write them yourself. This distinguishes a capture/transport problem from a local path problem.
png = driver.get_screenshot_as_png()
if not png:
raise RuntimeError("WebDriver returned no PNG bytes")
out.write_bytes(png)
if out.stat().st_size == 0:
raise RuntimeError("The written PNG is empty")
You can use get_screenshot_as_base64() when an API or log pipeline expects Base64, but avoid dumping large image data into ordinary test logs.
Fix screenshots that are blank, stale, or incomplete
Wait for the state you need, not just the load event
driver.get(url) waits for the page-load event, but modern applications often render data afterward. Deferred images, animations, client-side requests, and hydration can still be in progress. Wait for a page-specific condition, then inspect the URL, title, and target element before capturing.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →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.
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
wait = WebDriverWait(driver, 30)
driver.get("https://example.com/dashboard")
wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "main")))
print(driver.current_url, driver.title)
driver.save_screenshot(str(out))
Choose a condition that represents your application’s ready state: a result row, a visible heading, or a spinner disappearing. A fixed sleep can be useful for a known animation, but it is usually less reliable than an explicit condition.
Confirm the screenshot scope
A normal driver screenshot is the current window viewport. It is not automatically a full-page image. If the result looks clipped, decide whether you need the viewport, one element, or the entire document, then use the corresponding Selenium or browser-specific capability documented in the API. Element screenshots are appropriate for a component; full-page behavior varies by browser and driver, so verify it in your target environment instead of assuming one universal implementation.
Inspect the page before blaming the PNG
- Print
driver.current_urlanddriver.titleto catch redirects and error pages. - Locate the element you expect and report its displayed state and dimensions.
- Set the window size explicitly when responsive layout affects what is visible.
- Disable or wait out transitions when an animation can be captured mid-frame.
- Check whether a cookie dialog, login wall, bot check, or application error is covering the content.
A valid, non-empty PNG can still faithfully show a blank page, an interstitial, or a viewport that is too small. Those are page-state or scope issues, not necessarily file-write failures.
Why PhantomJS screenshots fail more often now
PhantomJS is not a current foundation for a new Selenium pipeline. Its official site states that “PhantomJS development is suspended until further notice,” and the project repository is archived and read-only as of May 30, 2023. Selenium’s Python change notes deprecate PhantomJS and recommend headless Chrome or Firefox instead. See the PhantomJS project homepage and Selenium Python change notes.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsRank #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
Suspension does not identify one universal exception or blank-image cause. Old PhantomJS/GhostDriver combinations can diverge from current JavaScript, TLS, CSS, and web-platform behavior. Treat migration as the durable fix rather than spending extensive time patching an obsolete browser.
Migration checklist
- Record the existing URL, viewport, waits, cookies, headers, expected screenshot scope, and output path.
- Install a maintained Chrome or Firefox browser and the driver setup required by your environment.
- Replace the PhantomJS driver construction with
webdriver.Chrome()orwebdriver.Firefox(), adding the appropriate headless option for the installed browser. - Run the same page-state checks and capture assertions.
- Compare viewport dimensions, fonts, lazy-loaded content, and full-page behavior; browser engines can render details differently.
- Keep the reproduction details—Python and Selenium versions, browser and driver versions, operating system or container, exact exception, URL, and desired scope—when a discrepancy remains.
Chrome headless or Firefox headless?
The cited Selenium material establishes support and the migration direction, not a universal performance or visual-fidelity winner. Choose based on the engine your application must match, the browser coverage your team already tests, deployment and driver availability, and whether you need viewport, element, or full-page capture. Validate the pages that matter to your product rather than selecting a browser from an unsupported blanket ranking.
Common symptoms and targeted fixes
| Symptom | Likely area | Action |
|---|---|---|
save_screenshot() returns False |
File I/O | Use an absolute PNG path, create the parent directory, verify permissions and disk space, and log the resolved path. |
| No file appears | Path or process environment | Check the working directory, container mount, user ownership, and whether the test cleans artifacts afterward. |
| File exists but is zero bytes | Write pipeline | Check the Boolean, use get_screenshot_as_png(), and verify the destination after writing. |
| Image is a blank page or error page | Browser/page state | Print URL and title, inspect the target element, wait for application readiness, and look for redirects or interstitials. |
| Only part of the page is visible | Screenshot scope | Confirm viewport versus element versus full-page requirements and use the documented capability for that scope. |
| PhantomJS crashes or renders obsolete content | Unsupported browser | Move to headless Chrome or Firefox and retest with the same state and dimensions. |
| Results differ between laptop and CI | Environment | Record browser/driver versions, OS or container image, viewport, fonts, network conditions, and authentication state. |
Make failures observable and repeatable
For every failed capture, preserve a small diagnostic record: the resolved output path, Boolean return value, file size, current URL, title, viewport dimensions, browser and Selenium versions, and the exception text. Store a page-source snapshot or a screenshot of the first visible error when policy permits. Keep browser cleanup in a finally block so a failure does not leave orphaned processes that affect later tests.
Separate three assertions in your test:
- Capture: WebDriver returned bytes or reported a successful file save.
- Artifact: the expected path exists and has a non-zero size.
- Visual state: the page, element, and scope match what the test intends to preserve.
This separation makes retries meaningful. Retrying a permission error will not fix it; waiting for a missing application element may.
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
- 【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.
Or skip the browser setup
ScreenshotNeo provides a website screenshot API and MCP server when you want one HTTP request instead of maintaining a Selenium browser. It accepts consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step can be disabled. 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 server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.
Using the ScreenshotNeo API documentation, a one-call capture looks like this:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Create a free ScreenshotNeo account to try it without a card.
FAQ
Can Selenium save JPEG or WebP with save_screenshot()?
The documented file helper saves a PNG. Convert the resulting PNG with an image library if another format is required.
Recommended Free Tools
Does a successful save prove the page loaded correctly?
No. It proves Selenium reported a successful file write. Check the file, its size, URL, title, expected element, and capture scope separately.
Should I keep PhantomJS for a legacy test?
Only with a clear containment plan and acceptance of its suspended, deprecated status. A maintained headless Chrome or Firefox setup is the documented migration direction.
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.

