Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Use Selenium WebDriver’s save_screenshot() method after the page reaches the state you want to preserve:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://example.com")
ok = driver.save_screenshot("screenshot.png")
print(ok) # True when the PNG was written
driver.quit()
The method captures the current browser window as a PNG and returns True when Selenium writes the file. A return value of False indicates an operating-system file-write error. The filename should end in .png; using an explicit, writable path avoids most surprises.
Minimal Selenium screenshot script
Install Selenium with pip install selenium, then run this complete example. Recent Selenium versions can manage a compatible browser driver automatically in common setups; otherwise install and configure the driver required by your browser.
from pathlib import Path
from selenium import webdriver
output = Path("artifacts")
output.mkdir(parents=True, exist_ok=True)
options = webdriver.ChromeOptions()
# options.add_argument("--headless=new") # Uncomment for a headless run.
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com")
ok = driver.save_screenshot(str(output / "homepage.png"))
if not ok:
raise OSError("Selenium could not write the screenshot")
print("Saved", output / "homepage.png")
finally:
driver.quit()
save_screenshot(filename) is documented as saving the current window to a PNG file. Selenium’s Python implementation writes PNG bytes to the supplied path and returns False if an OSError occurs. Use a full path when a test runner, service, or container may have a different working directory. (See the Selenium Python WebDriver API documentation.)
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.
Save the current window to a file
Check the Boolean result
The return value is part of the API, not merely a convenience. Treat False as a failed artifact and report it in your test or job rather than silently continuing.
ok = driver.save_screenshot("/absolute/path/screenshot.png")
if not ok:
print("Screenshot file was not written")
Use the alternate method name
get_screenshot_as_file() performs the same file-saving operation in the current Python implementation:
ok = driver.get_screenshot_as_file("artifacts/homepage.png")
Create the destination directory first and ensure the process has write permission. Selenium opens the path in binary write mode; a missing directory, read-only mount, invalid path, or other OSError produces a failed write.
Choose a deterministic filename
For parallel tests, include the test name or a timestamp so workers do not overwrite one another:
from datetime import datetime, timezone
stamp = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ")
path = f"artifacts/login-{stamp}.png"
assert driver.save_screenshot(path)
Capture PNG bytes instead of writing immediately
Call get_screenshot_as_png() when another library, object store, or test-reporting system should receive the image 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_bytes = driver.get_screenshot_as_png()
with open("artifacts/in-memory.png", "wb") as image_file:
image_file.write(png_bytes)
This method returns binary PNG data. Because you control the write operation, handle its exceptions and storage policy yourself.
Embed a screenshot as Base64
get_screenshot_as_base64() returns a Base64 string suitable for HTML or text transport:
base64_image = driver.get_screenshot_as_base64()
html = f'
'
with open("report.html", "w", encoding="utf-8") as report:
report.write(html)
Base64 is convenient for self-contained reports, but it increases the textual payload compared with keeping the PNG as a binary file. Use bytes or a file when your reporting system accepts binary attachments.
Capture one element rather than the whole window
Locate the component and call its screenshot() method:
element = driver.find_element("css selector", "#checkout")
element.screenshot("artifacts/checkout.png")
This is useful for a card, form, chart, or assertion target. The element must exist in the DOM when you locate it. If it is rendered asynchronously, wait for an appropriate condition before taking the shot.
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.
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
element = WebDriverWait(driver, 20).until(
EC.visibility_of_element_located((By.CSS_SELECTOR, "#checkout"))
)
element.screenshot("artifacts/checkout.png")
Wait for the state you actually want
Selenium captures immediately; it does not infer that a page’s images, animations, consent dialog, or application data are ready. Add an explicit wait for a meaningful condition instead of relying only on a fixed sleep.
Wait for a visible element
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, 20)
wait.until(EC.visibility_of_element_located((By.CSS_SELECTOR, "main")))
driver.save_screenshot("artifacts/ready.png")
Wait for a document-ready state
WebDriverWait(driver, 20).until(
lambda d: d.execute_script("return document.readyState") == "complete"
)
driver.save_screenshot("artifacts/document-ready.png")
document.readyState does not guarantee that client-side requests, lazy images, fonts, or animations have finished. For those, wait for the application-specific selector or condition. If a screenshot must show a stable animation frame, disable animations with a test stylesheet or wait for the animation’s completed state.
Full-page screenshots and portability
The ordinary window methods capture the current browser window, not necessarily the entire document. Full-document capture is driver-specific. Firefox’s API documents get_full_page_screenshot_as_file():
driver.get_full_page_screenshot_as_file("artifacts/firefox-full-page.png")
Do not present that call as a universal WebDriver feature. If your test suite must run across Chrome, Edge, and Firefox, verify each driver’s supported full-page capability or use a separate capture service. Window size, device pixel ratio, fixed headers, sticky elements, lazy loading, and very tall pages can all affect the result.
Useful browser setup controls
Headless execution
Headless mode is useful in CI or containers. The screenshot API is the same; only browser startup changes:
options = webdriver.ChromeOptions()
options.add_argument("--headless=new")
options.add_argument("--window-size=1440,1200")
driver = webdriver.Chrome(options=options)
Set the window size explicitly when visual comparisons depend on responsive breakpoints. A headless default viewport can differ from a developer workstation.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsRank #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
Set a viewport before navigation
driver.set_window_size(1440, 900)
driver.get("https://example.com")
Changing the size can trigger responsive layout changes, so set it before the page reaches the state you intend to capture.
Hide an obstructing element for a test-only capture
driver.execute_script("""
const banner = document.querySelector('.cookie-banner');
if (banner) banner.remove();
""")
driver.save_screenshot("artifacts/content.png")
Only alter the page when that is part of your test’s purpose. Removing a banner may make a visual test unlike what a real visitor sees.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Common failures and fixes
File returns False or is missing
- Confirm the parent directory exists; create it with
Path(...).mkdir(parents=True, exist_ok=True). - Use a writable absolute path and check disk space and container volume permissions.
- Keep the
.pngextension and inspect the Boolean result.
FileNotFoundError for the destination
Selenium does not create parent directories. Create them before calling the method and avoid assuming the process’s current directory.
SessionNotCreatedException
The browser and driver may be incompatible, the browser may be unavailable in the runtime, or startup flags may be invalid. Install a supported browser, allow Selenium’s driver management to resolve it, or configure the matching driver explicitly. In containers, verify required shared-memory and sandbox settings for that image.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Screenshot is blank or taken too early
Wait for a visible, application-specific element, then capture. Check that navigation did not end on an error page, that the element is not covered by a modal, and that a headless viewport is large enough for the expected layout.
Element screenshot raises a lookup error
Use the correct locator and wait for presence or visibility. An element inside an iframe requires switching into that frame first; an element in a shadow root requires the component’s shadow-DOM access pattern.
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.
Full-page output is truncated or inconsistent
Use the driver-specific API documented for your browser, test with the exact driver version used in CI, and account for lazy-loaded content and sticky positioning. The basic current-window method is not a substitute for a full-document implementation.
Choosing the Selenium output method
| Method | Scope | Output | Failure signal |
|---|---|---|---|
save_screenshot() |
Current window | PNG file | Boolean; False on file I/O error |
get_screenshot_as_file() |
Current window | PNG file | Boolean; same Python implementation |
get_screenshot_as_png() |
Current window | PNG bytes | Handle errors when storing or processing bytes |
get_screenshot_as_base64() |
Current window | Base64 text | Handle transport or embedding errors |
element.screenshot() |
One element | PNG file | Element lookup, visibility, and file errors |
get_full_page_screenshot_as_file() |
Full document where supported | PNG file | Driver-specific behavior |
Or skip the browser setup
ScreenshotNeo provides a website screenshot API when you need a URL capture without managing Selenium, a browser binary, or driver sessions. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks, CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status.
Recommended Free Tools
Use the API documentation at https://screenshotneo.com/docs/ for options such as full-page capture, element selectors, device presets, custom viewports, retina scale, PDF output, custom CSS or JavaScript, waits, request blocking, cookies, headers, geolocation, caching, signed links, asynchronous webhooks, bulk capture, and usage reporting.
One-call examples
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
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)
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(`HTTP ${res.status}`);
const image = Buffer.from(await res.arrayBuffer());
ScreenshotNeo also includes an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots per month with no card; paid plans start at $5 for 3,000 shots, and every feature is available on every plan. Sign up free for 1,000 screenshots a month.
Frequently Asked Questions
Does Selenium save screenshots as JPEG or WebP?
The Python WebDriver screenshot methods documented here produce PNG output. Convert the resulting bytes with an image-processing library if another format is required.
Can I call save_screenshot before get()?
You can call it after a driver session starts, but it will capture the browser’s current state. Navigate first when the target is a web page.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Is a screenshot proof that every network request finished?
No. Selenium captures the rendered state at the instant of the call. Wait for the application condition that matters to your test.
Which method should a test-report plugin use?
Use PNG bytes when the plugin accepts binary attachments; use Base64 when it specifically expects text or an HTML data URL.
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.

