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

Use Selenium to capture a page in a repeatable browser state, compare the image with a reviewed baseline, and inspect the difference before accepting any visual change. Selenium provides screenshot capture; it does not provide a built-in visual regression comparator, so your project must supply comparison and baseline review.

How Selenium screenshots fit into visual regression testing

A screenshot is the capture step, not the whole test. A useful regression workflow captures the same page state on each run, compares it with an approved baseline, reports differences, and updates the baseline only after someone confirms that the new appearance is intended. Selenium’s Python WebDriver API saves the current window as a PNG and can also save an individual element. Selenium screenshot documentation

The Selenium capture methods do not decide whether two images are acceptably similar. You need a separate image comparison library, script, or visual testing service, plus a process for reviewing diffs and managing baselines.

Capture a screenshot with Selenium in Python

Install Selenium with python -m pip install selenium. Selenium’s official example uses Chrome WebDriver; current Selenium can manage browser-driver setup, but you still need a compatible browser installed. The sample below navigates to a page, waits for its document load, saves a PNG, checks the returned success flag, and closes the browser even if capture fails.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • 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 pathlib import Path
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait

output = Path("artifacts/homepage.png")
output.parent.mkdir(parents=True, exist_ok=True)

driver = webdriver.Chrome()
try:
    driver.set_window_size(1440, 1000)
    driver.get("https://example.com")
    WebDriverWait(driver, 20).until(
        lambda browser: browser.execute_script("return document.readyState") == "complete"
    )

    if not driver.save_screenshot(str(output)):
        raise OSError(f"Could not write screenshot to {output.resolve()}")
    print(f"Saved {output.resolve()}")
finally:
    driver.quit()

The official API describes save_screenshot(filename) as saving the current window to PNG. It returns True when successful and False on an I/O error. Use a path ending in .png, and treat a false result or missing artifact as a failed capture rather than a passing visual test. Python WebDriver API

Capture a component instead of the whole window

If the assertion concerns one stable component, locate it and call the element’s screenshot() method. The output is still a PNG. This can reduce unrelated page changes in the comparison, but make sure the element is visible and in the expected state before capturing it.

from selenium.webdriver.common.by import By

card = driver.find_element(By.CSS_SELECTOR, "[data-testid='pricing-card']")
if not card.screenshot("artifacts/pricing-card.png"):
    raise OSError("Could not save component screenshot")

Selenium documents both window and element screenshot examples at its WebDriver interactions documentation.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 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.

Build a baseline-and-diff workflow

  1. Create a baseline deliberately. Run the capture against the intended application state and review the image. Store accepted baseline images in version control or another reviewable store.
  2. Capture the same state on later runs. Use the same browser setup, route, viewport, data, and interaction sequence. Wait for the page content that matters rather than relying only on a fixed delay.
  3. Compare current and baseline images. Supply this step with an image comparison library or a visual-testing service. Choose comparison sensitivity based on your rendering environment and acceptable variation; Selenium itself does not set that policy.
  4. Review the diff when comparison fails. Preserve the current image and a useful diff as CI artifacts so a reviewer can distinguish a real regression from rendering noise.
  5. Approve intentional changes explicitly. Update the baseline only after confirming the changed appearance is expected. Automatically replacing every failing baseline can erase evidence of a defect.

Make captures repeatable

Visual comparisons are meaningful only when the browser and page conditions are sufficiently consistent. Keep the browser and driver, operating environment, fonts, viewport dimensions, test data, and application state stable between baseline creation and later runs. Wait for the meaningful page state before capturing; a completed document load does not necessarily mean client-rendered content, images, or asynchronous data are ready.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Use a fixed viewport and consistent browser environment for baseline and test runs.
  • Disable or freeze animations where practical so a capture does not land on a different animation frame.
  • Mask or ignore only known volatile regions, such as a changing timestamp. Ignoring too much can conceal a genuine defect.
  • Keep baseline files and change approvals reviewable, and retain current screenshots and diffs when CI reports a mismatch.

Percy’s Python Selenium integration documents controls such as animation handling, ignored regions, full-page capture, and element scopes; the exact supported options and setup should be checked in its current project documentation. Percy Python Selenium repository

Choose local comparison or managed snapshots

Local capture and comparison

A local pipeline gives your project control over capture, baseline storage, thresholds, and review integration. The trade-off is that your team must provide the comparator and baseline workflow; Selenium’s screenshot API alone does not do this.

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • 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.

Managed snapshot workflow

Percy documents a Python Selenium integration that uses percy_snapshot(driver, name); snapshot names should be unique. Its repository describes options including full-page capture, animation handling, ignored regions, and element scopes. Verify current setup and supported options in the repository before adopting it.

Applitools’ surfaced integration material is for Playwright, not proof of a current Selenium/Python drop-in integration. Treat it as an option to investigate only after verifying support for your exact stack. Applitools Playwright integration

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.

When evaluating any managed visual testing option, check Python/Selenium support, baseline approval and storage, CI integration, treatment of dynamic content and animation, capture scope, diff review, comparison sensitivity, and current terms. Pricing is not established here.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • 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

Troubleshoot failed or noisy screenshots

  • No image was written: Check that the output directory exists, the path is writable, and the filename ends in .png. Check the boolean returned by save_screenshot() and verify the artifact exists.
  • The screenshot shows a loading state: Wait for the specific content or condition the test needs, not just document readiness. Confirm any asynchronous requests or client-side rendering have completed.
  • Images or lower-page content are missing: Ensure the relevant content has been brought into the expected state before capture. The basic current-window screenshot example does not promise a full-page capture.
  • Images differ across otherwise identical runs: Check browser and driver versions, operating environment, fonts, viewport, test data, and animation state. Identify volatile areas and mask them narrowly rather than broadening the tolerance blindly.
  • A mismatch is intentional: Review the current screenshot and diff, then update the accepted baseline through your normal review process. Do not make baseline replacement an automatic reaction to every failure.
  • Element screenshot fails or captures the wrong region: Confirm the CSS selector identifies the intended element and that it is present and visible before capture.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or skip the browser setup

If you need an image from a URL rather than a Selenium-driven interaction, ScreenshotNeo is a website screenshot API with a single GET request. Its clean-shot steps can accept cookie/consent banners and remove more than 60 known consent platforms, newsletter popups, and chat widgets before capture; each step 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. An MCP server offers take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots.

For full API options, see the ScreenshotNeo documentation. Replace the example target URL with the page you want to capture:

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

This URL-based call is not a replacement for Selenium when your test must log in, click through a specific interaction, or reproduce an application state controlled by browser automation. Sign up for ScreenshotNeo’s free plan: 1,000 screenshots a month, no card required.

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

Frequently Asked Questions

Does Selenium include visual comparison?

No. Selenium provides screenshot capture; your project must supply the image comparison and baseline review workflow, or use a separate visual testing integration.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 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.

Can I compare only one component?

Yes. Locate the element and use its screenshot() method to capture that component rather than the current window.

Does the sample guarantee a full-page screenshot?

No. It saves the current window. Full-page capture requires a separate approach or integration.

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.

Free tools Windows power users keep installed

One-click scans. No signup required.

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