First find out whether Selenium captured image bytes at all. Check the result of save_screenshot(), inspect the bytes from get_screenshot_as_png(), and check the file’s size. If the bytes are empty, investigate the browser session, page state, and window dimensions; if the bytes exist but the file is empty, investigate the path, permissions, or code that later overwrites it. Headless Chrome can take screenshots, so headless mode alone does not identify the cause.
Diagnose capture separately from file saving
Selenium’s Python screenshot methods return a boolean when saving to a file: False indicates an I/O error. A True result means the save call completed, but does not by itself establish that the image data was nonempty. Inspect the in-memory PNG bytes as well as the save result.
from pathlib import Path
path = Path("/absolute/path/screenshot.png")
png = driver.get_screenshot_as_png()
print("PNG bytes:", len(png))
saved = driver.save_screenshot(str(path))
print("save_screenshot returned:", saved)
print("File bytes after save:", path.stat().st_size if path.exists() else "file not found")
Run this after creating a live WebDriver session and navigating to the page you want to capture. The absolute path’s parent directory must already exist. The byte count and boolean distinguish several failure stages:
- PNG byte count is zero: the problem is upstream of writing. Check the active browser session, whether navigation reached the intended page, and the current window dimensions.
- PNG bytes exist, but saving returns
False: investigate the destination path and whether the process can write there. - Bytes exist and saving returns
True, but the file is missing or empty afterward: check whether later test cleanup, teardown, or another process deletes, replaces, or truncates it.
This separation follows Selenium’s Python save implementation: it obtains the screenshot data and then writes it to the named file in binary mode. It is a diagnostic inference, not a universal explanation for every empty file.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Check the output path and filename
Use a full path to an existing, writable directory, and give the file a .png suffix. Selenium documents PNG output and recommends a full path; its current Python implementation warns if the filename does not end in .png.
To test the write independently of Selenium’s file-saving method, write the captured bytes directly:
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
png = driver.get_screenshot_as_png()
print("PNG bytes:", len(png))
path = "/absolute/path/screenshot.png"
with open(path, "wb") as image_file:
image_file.write(png)
If png contains data and this direct write produces a nonempty file, compare the original destination and the code that runs after the save. If the byte count is zero, changing the output path will not fix the capture itself.
Verify the browser session, page, and viewport
Before taking the screenshot, confirm that the WebDriver session is still active and that it has navigated to the intended page. Ensure the current browser window has positive dimensions. Chrome’s headless screenshot example uses an explicit --window-size; it demonstrates a useful way to make the viewport deliberate, but does not establish that zero dimensions cause every empty Selenium screenshot.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Selenium’s official browser examples include screenshot capture with headless Chrome. Therefore, do not treat headless mode by itself as proof that screenshots are unsupported. The official material does not establish a single required delay, universal root cause, or version-specific fix for all empty files.
Common symptoms and what to check
| Symptom | What it indicates | Next check |
|---|---|---|
save_screenshot() returns False |
The file operation reported an I/O error. | Use an absolute path to an existing directory and verify that the process can write there. |
get_screenshot_as_png() returns no bytes |
The issue is before file writing. | Check that the session is live, navigation reached the target, and the window dimensions are positive. |
| PNG bytes exist, but the saved file is empty | Capture produced data, so focus on saving or what happens afterward. | Try writing the bytes directly, then inspect teardown and other processes for overwrite or truncation. |
| The file exists but has an unexpected extension | The filename may not match the documented PNG output convention. | Use a .png filename and a full path. |
Or skip the browser setup
If you need a screenshot without managing a Selenium browser session, ScreenshotNeo provides a website screenshot API and MCP server. This one-request example saves a WebP capture of the target URL; see the ScreenshotNeo API documentation for request options.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo accepts cookie or consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each of those steps can be turned off. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. Its MCP server offers take_screenshot, get_page_info, and capture_pdf for AI agents and other MCP clients. The free plan includes 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free plan to try it without a card.
Quick Recap
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
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.




