Free tools Windows power users keep installed
One-click scans. No signup required.
Use Selenium WebDriver to open the page, then call driver.save_screenshot('/path/to/screenshot.png'). The method captures the current browsing context as a PNG and returns True when the file is saved or False when an I/O error prevents saving.
Save a page screenshot with Selenium Python
Install Selenium in the Python environment that will run your script:
python -m pip install selenium
The browser driver must be available to Selenium. In current Selenium setups, Selenium Manager can often obtain a compatible driver automatically when you create webdriver.Chrome(); managed corporate machines may instead require an explicitly installed driver. The API reference used for this guide is for Selenium 4.49.0, so check the method reference against your installed version if you are maintaining an older release.
This complete example navigates, saves a PNG, checks Selenium’s Boolean result, and always closes the browser:
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →#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.
from selenium import webdriver
URL = "https://www.example.com"
OUTPUT = "/tmp/example.png"
driver = webdriver.Chrome()
try:
driver.get(URL)
saved = driver.save_screenshot(OUTPUT)
if not saved:
raise OSError(f"Selenium could not save the screenshot to {OUTPUT}")
finally:
driver.quit()
save_screenshot() captures the current browsing context. In practice, that means you should navigate to the intended URL and make sure the intended tab or window is selected before calling it. The documented file output is PNG, so use a filename ending in .png. The destination directory must already exist and be writable; an I/O problem is reported by a False return value.
Choose what Selenium should capture
The current page context
Use driver.save_screenshot(path) for the visible page in the active browser context:
driver.get("https://www.example.com/pricing")
if not driver.save_screenshot("pricing.png"):
raise OSError("Screenshot was not written")
Select the page state first. If your script opens a new tab or window, switch to that handle before saving:
driver.switch_to.window(target_window_handle)
driver.save_screenshot("target-tab.png")
A screenshot reflects the state at the instant of capture. If a page renders asynchronously, wait until the content you need is present before taking the image. A selector-based wait is preferable to an arbitrary delay when the page exposes a reliable element:
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minutefrom selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
wait = WebDriverWait(driver, 20)
driver.get("https://www.example.com/dashboard")
wait.until(lambda d: d.find_element(By.CSS_SELECTOR, "main.dashboard"))
driver.save_screenshot("dashboard.png")
One element
Locate an element and call its screenshot() method. This writes only that element’s rendered image:
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.
from selenium import webdriver
from selenium.webdriver.common.by import By
URL = "https://www.example.com"
driver = webdriver.Chrome()
try:
driver.get(URL)
heading = driver.find_element(By.CSS_SELECTOR, "h1")
if not heading.screenshot("heading.png"):
raise OSError("Element screenshot was not written")
finally:
driver.quit()
The element must exist in the current page and be locatable with the selector you provide. If your selector can match multiple nodes, choose the specific element you want rather than relying on an accidental first match.
PNG bytes in memory
When another Python component, an upload client, or a test needs image data instead of a file, use driver.get_screenshot_as_png():
png_bytes = driver.get_screenshot_as_png()
with open("memory-result.png", "wb") as image_file:
image_file.write(png_bytes)
This avoids asking Selenium to choose a destination path; your code controls how and where the returned PNG bytes are stored or transmitted.
Base64 for HTML or JSON
driver.get_screenshot_as_base64() returns a base64 string. That representation is useful when the receiving system expects text, such as an HTML data URI:
encoded = driver.get_screenshot_as_base64()
html = f'<img alt="Selenium capture" src="data:image/png;base64,{encoded}">'
print(html)
Use PNG bytes when your destination accepts binary data directly; use base64 when the protocol or document format is text-based.
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.
Control the page before taking the image
Selenium captures the browser state you create. A dependable workflow therefore separates navigation, state preparation, and capture:
- Open the target URL. Call
driver.get()and verify that the intended page, not an intermediate redirect or error document, is active. - Select the correct context. Switch to the required tab or window if the workflow created more than one.
- Wait for required content. Wait for a meaningful element or application state when JavaScript populates the page after navigation.
- Apply any interaction. Click, scroll, dismiss a dialog, or set a form value before capture if that state is part of the screenshot.
- Write or obtain the image. Choose a file, bytes, or base64 method according to the consumer.
- Check the result and clean up. Treat a false return as a failure and call
driver.quit()in afinallyblock.
The screenshot API is tied to the current browsing context; it is not a command for capturing the operating-system desktop or browser window chrome. For a different tab, switch first. For a single component, use the element method rather than cropping a full-page image afterward.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated 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 matchHeadless and repeatable captures
For automation or CI, run Chrome without a visible window by supplying a headless argument. Keep the same screenshot calls:
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("--headless")
driver = webdriver.Chrome(options=options)
try:
driver.get("https://www.example.com")
if not driver.save_screenshot("ci-shot.png"):
raise OSError("Could not save CI screenshot")
finally:
driver.quit()
Headless mode does not change the need for a writable path, a selected window, or a wait for dynamic content. If a visual test depends on a particular viewport, configure the browser window size before navigation so layout is deterministic:
driver.set_window_size(1440, 900)
Keep output names unique when a suite captures several pages. Writing every run to the same path can hide which test produced an image and can create races when tests run concurrently.
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
Common failures and fixes
| Symptom | Likely cause | Fix |
|---|---|---|
save_screenshot() returns False |
The destination cannot be written, or its directory does not exist. | Create the directory, use a writable absolute path, and check permissions. Keep the Boolean check so the job fails instead of silently continuing. |
FileNotFoundError when saving |
The parent directory is missing. | Create it before capture, for example with pathlib.Path("artifacts").mkdir(parents=True, exist_ok=True). |
InvalidSessionIdException or a closed-browser error |
The driver was quit before the screenshot call, or the session crashed. | Capture before driver.quit(); create a fresh driver after a crashed session. |
NoSuchWindowException |
The selected tab or window was closed. | Inspect available window handles and switch to a live handle before capture. |
NoSuchElementException for an element screenshot |
The selector is wrong or the element has not rendered yet. | Verify the selector and wait for the element before calling element.screenshot(). |
| The image shows a loading shell | Client-side content was still rendering when the call ran. | Wait for a content-specific element or state instead of relying only on navigation completion. |
| The image is from the wrong page | A redirect, popup tab, or previous navigation left another context active. | Check the current URL and window handle, then navigate or switch explicitly. |
| The output is not a valid image | Binary PNG bytes were treated as text, or a base64 string was saved without decoding. | Write get_screenshot_as_png() with binary mode ("wb"), or decode base64 before writing. |
Performance, reliability, and storage notes
- Reuse a driver for a batch. Starting a browser is more expensive than taking another screenshot. Navigate between pages in one controlled session when isolation requirements allow it.
- Use explicit readiness conditions. A short, relevant wait is generally more repeatable than a fixed sleep, which may be too short on a slow run and wasteful on a fast one.
- Write to local artifacts first. Save the PNG, verify the Boolean result, then upload or process it. This separates browser failures from storage-service failures.
- Always close sessions. A
finallyblock prevents orphaned browser processes when navigation, lookup, or file writing raises an exception. - Preserve evidence on failure. In a test suite, include the URL and test name in the output filename so a failed image can be traced to its source.
Or skip the browser setup
If you need a URL screenshot without managing Selenium, ScreenshotNeo provides a GET endpoint that returns PNG, JPEG, WebP, or PDF. It accepts the consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each cleanup step can be disabled. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and each response identifies the page verdict and billing status in X-Page-Verdict and X-Billed headers.
One call is enough:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for parameters and response handling. Equivalent Python and Node.js calls are:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
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}`);
ScreenshotNeo also offers an MCP server with take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. Its 63 options include full-page capture with lazy images loaded, CSS-selector element capture, dark mode, device presets and custom viewports, retina scale, PDF controls, custom CSS and JavaScript, clicks, waits, hiding selectors, request and resource blocking, headers, cookies, user agent and authorization, timezone and geolocation, transparent backgrounds, resizing, selectable cache TTL, signed links, async jobs with signed webhooks, bulk capture for up to 100 URLs per call, a usage API, and an OpenAPI specification. Common parameter names used by other screenshot APIs are accepted to ease migration.
| Plan | Included shots | Price |
|---|---|---|
| Free | 1,000 per month | $0, no card |
| Starter | 3,000 | $5 |
| Growth | 15,000 | $15 |
| Pro | 60,000 | $39 |
| Scale | 250,000 | $99 |
| Business | 1,000,000 | $249 |
Every feature is included on every plan, and yearly billing provides two months free. Create a free ScreenshotNeo account to get 1,000 screenshots a month with no card; paid plans start at $5 for 3,000.
FAQ
Can Selenium save a JPEG or WebP with save_screenshot()?
The documented Selenium file method produces PNG output. Use a PNG filename, then convert the image afterward if another format is required.
Recommended Free Tools
What does “current browsing context” mean?
It is the page context currently controlled by WebDriver: the active tab or window and its rendered content. Switch contexts before capture when your automation has more than one tab.
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.
When should I use bytes instead of a screenshot file?
Use get_screenshot_as_png() when your application can consume binary data directly, and get_screenshot_as_base64() when the receiving format is text, such as an HTML data URI.
Frequently Asked Questions
Can Selenium save a JPEG or WebP with save_screenshot()?
The documented Selenium file method produces PNG output. Use a PNG filename, then convert the image afterward if another format is required.
What does “current browsing context” mean?
It is the page context currently controlled by WebDriver: the active tab or window and its rendered content. Switch contexts before capture when your automation has more than one tab.
When should I use bytes instead of a screenshot file?
Use get_screenshot_as_png() when your application can consume binary data directly, and get_screenshot_as_base64() when the receiving format is text, such as an HTML data URI.
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.

