What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Automate video tests by driving the player in a real browser, waiting for observable media state changes, and asserting the behavior the user should see. A page loading—or a fixed sleep ending—is not proof that a video can play. This Python example checks that a video becomes ready, starts playing, advances, pauses, and seeks to a target position.
What a Selenium video test should verify
Selenium WebDriver controls a browser through its native automation interface, so it can exercise page controls and inspect the HTML media element. The Selenium Project describes WebDriver as driving a browser natively: WebDriver documentation.
Keep each test tied to a behavior: the play control starts playback, playback advances, pause stops it, seeking reaches a target, or an error path handles an unavailable source. Use a deterministic page and known video fixture where possible; a public streaming service introduces variability outside the behavior your test is meant to validate.
Set up Selenium and a deterministic fixture
The example uses Python, Selenium 4, and pytest. It assumes your test page is served locally at http://localhost:8000/video-test.html, has a <video id="test-video"> element, and includes buttons with IDs play, pause, and seek. Adapt those selectors and the fixture URL to your application. Current Selenium documentation describes Selenium Manager as handling browser and driver management by default; confirm the binding and browser details for your environment in the Selenium documentation.
#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.
Install the Python binding and pytest in your project environment:
python -m pip install selenium pytest
Save as test_video.py. The explicit waits poll browser-observable state rather than relying on arbitrary delay lengths.
import time
import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
@pytest.fixture
def driver():
# Selenium Manager can resolve the driver for a supported installed browser.
browser = webdriver.Chrome()
browser.set_window_size(1280, 900)
yield browser
browser.quit()
def wait_for_video(driver, condition, timeout=20):
return WebDriverWait(driver, timeout).until(
lambda d: d.execute_script(
"""
const video = document.querySelector(arguments[0]);
if (!video) return false;
return arguments[1](video);
""",
"video#test-video",
condition,
)
)
def test_video_play_pause_and_seek(driver):
driver.get("http://localhost:8000/video-test.html")
video_selector = "video#test-video"
WebDriverWait(driver, 15).until(
lambda d: d.find_element(By.CSS_SELECTOR, video_selector).is_displayed()
)
# HAVE_METADATA means duration and track metadata are available.
WebDriverWait(driver, 20).until(
lambda d: d.execute_script(
"""const v = document.querySelector(arguments[0]);
return v && v.readyState >= HTMLMediaElement.HAVE_METADATA;""",
video_selector,
)
)
# Exercise the UI as a user would. The site's handler should call play().
driver.find_element(By.ID, "play").click()
# A rejected play() promise may leave the element paused; surface that state.
WebDriverWait(driver, 15).until(
lambda d: d.execute_script(
"""const v = document.querySelector(arguments[0]);
return v && !v.paused && !v.error;""",
video_selector,
)
)
start_time = driver.execute_script(
"return document.querySelector(arguments[0]).currentTime;", video_selector
)
WebDriverWait(driver, 10).until(
lambda d: d.execute_script(
"""const v = document.querySelector(arguments[0]);
return v && v.currentTime > arguments[1];""",
video_selector,
start_time,
)
)
driver.find_element(By.ID, "pause").click()
WebDriverWait(driver, 10).until(
lambda d: d.execute_script(
"return document.querySelector(arguments[0]).paused;", video_selector
)
)
# Seek only to a point within a finite-duration fixture.
duration = driver.execute_script(
"return document.querySelector(arguments[0]).duration;", video_selector
)
assert duration and duration > 5, "Fixture must have a finite duration over 5 seconds"
target = min(5, duration - 1)
driver.find_element(By.ID, "seek").click()
driver.execute_script(
"document.querySelector(arguments[0]).currentTime = arguments[1];",
video_selector,
target,
)
WebDriverWait(driver, 10).until(
lambda d: d.execute_script(
"""const v = document.querySelector(arguments[0]);
return v && !v.seeking && Math.abs(v.currentTime - arguments[1]) < 0.75;""",
video_selector,
target,
)
)
In Python source, use normal JavaScript operators in the strings passed to execute_script; if copying from HTML, replace escaped entities such as && and > with && and > as the code literal requires. For reliable copy-paste, the two script expressions containing HTML-escaped operators can instead be written as follows:
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.
return v && v.readyState >= HTMLMediaElement.HAVE_METADATA;
return v && !v.paused && !v.error;
When running from a plain Python file, those JavaScript snippets must contain literal && as the JavaScript logical operator and >= as the comparison operator—not HTML entities. Run the test with:
Recommended Free Tools
pytest -q test_video.py
The fixture and selector contract are application-specific; without a page implementing those controls and a playable fixture, this example cannot pass unchanged.
Wait for the media state your test needs
HTMLMediaElement exposes useful state including readyState, paused, ended, currentTime, duration, currentSrc, and error. Its events distinguish milestones and problems: loadeddata, playing, pause, seeking, seeked, waiting, stalled, ended, and error. See MDN’s HTMLMediaElement reference and readyState reference.
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.
HAVE_NOTHINGmeans the browser has no media information.HAVE_METADATAmeans metadata such as duration is available.HAVE_CURRENT_DATAmeans data for the current playback position is available.HAVE_FUTURE_DATAmeans some future playback data is available.HAVE_ENOUGH_DATAis the browser’s estimate that enough data is available to play through without interruption.
That final state is an estimate, not a guarantee that a long video or live stream will remain uninterrupted. Choose the threshold based on the assertion: metadata for duration checks, current-frame data for a first-frame check, or actual advancement for a playback smoke test.
Handle play() as an asynchronous operation
Browser playback policy may block script-initiated playback. The play() method returns a Promise that can resolve later or reject, including for autoplay policy or unsupported media. A UI test should click the page’s play button and wait for observable playback instead of assuming a click succeeded. If your application directly invokes play(), handle its rejection in the application code as well. See MDN’s play() reference.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Assert transitions, not merely readiness
- For a playback smoke test, require
paused === falseandcurrentTimeto advance. - For pause behavior, click the pause control and wait for
paused === true. - For seeking, wait until
seekingis false andcurrentTimeis close to the requested position; theseekedevent is another useful signal. - For completion, use a short controlled fixture and check
ended; do not wait for a production-length video merely to test the control flow. - For a failure path, use a deliberately unsupported or unavailable fixture and assert the page’s intended error behavior.
Capture diagnostics when a test fails
Record enough context to distinguish a selector failure, a media-load problem, a rejected play request, and buffering. At failure, capture browser and driver versions along with the element state:
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
state = driver.execute_script("""
const v = document.querySelector('video#test-video');
if (!v) return { found: false };
return {
found: true,
currentSrc: v.currentSrc,
currentTime: v.currentTime,
duration: v.duration,
readyState: v.readyState,
paused: v.paused,
ended: v.ended,
seeking: v.seeking,
networkState: v.networkState,
errorCode: v.error ? v.error.code : null,
errorMessage: v.error ? v.error.message : null
};
""")
print(state)
Also retain a screenshot, page URL, browser console/runtime errors, and relevant network activity where available. Selenium WebDriver BiDi can stream browser events such as network requests, console messages, and JavaScript errors. Selenium documents BiDi as an evolving implementation; check current browser and language-binding support before making a test depend on it: WebDriver BiDi documentation.
Run locally first, then expand with Selenium Grid
A local browser session is usually the simplest way to stabilize selectors, fixtures, and state waits. Use Selenium Grid when you need tests distributed across several machines or a browser/operating-system matrix. Grid’s purpose includes distributing tests across machines and environments: Grid documentation.
| Approach | Best fit | Trade-off |
|---|---|---|
| Local WebDriver | Developing a deterministic test and debugging one browser configuration | Coverage is limited to the environment you run locally. |
| Selenium Grid | Distributing runs across browser and operating-system environments | Requires configuring or using a Grid and managing its execution environments. |
| WebDriver with BiDi diagnostics | Tests that need streamed console, runtime-error, or network events in addition to DOM/media state | BiDi support is evolving, so compatibility must be verified for the chosen browser and binding. |
What Selenium video tests can and cannot establish
A browser test can verify that a particular page and browser respond to user actions and reach expected media states. By itself, it does not prove perceptual picture or audio quality, codec coverage on every hardware configuration, or sustained streaming quality under realistic network conditions. Add visual, audio, codec, or network-condition testing when those are part of the requirement. A single readyState threshold cannot prove a long video or live stream will play without buffering.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsBest 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.
Troubleshoot common failures
The video element never appears
- Check that the test is on the expected page and that the selector matches the rendered player.
- If the player is inside an iframe, switch Selenium into that frame before locating its DOM. For a cross-origin embedded player, frame access and the provider’s player API depend on that implementation; there is no universal Selenium procedure.
Metadata or the first frame never loads
- Check
currentSrc,networkState,readyState, anderror, then inspect browser console and network errors. - Confirm the fixture URL is reachable by the browser and that its media format is supported in the tested browser.
- Use a controlled local fixture for repeatable behavior rather than a public service that can change or vary by network.
The play click does not start playback
- Verify the intended control is visible, enabled, and wired to the player.
- Check whether the page’s play request was rejected by autoplay policy or because the source is unsupported; do not treat a click as proof of playback.
- Wait for
pausedto become false and forcurrentTimeto advance. Inspect the page’s error handling if neither occurs.
The test times out during a seek or intermittently during playback
- Choose a seek position within the fixture’s finite duration and wait for seeking to finish before comparing the resulting time.
- Do not assert exact floating-point equality for
currentTime; allow a small tolerance appropriate to the test. - Investigate
waiting,stalled, and network behavior before increasing a timeout. A longer timeout can hide a real stall without making the test more deterministic.
The test fails only on another browser or Grid node
- Capture browser, driver, operating-system, media state, and fixture details for each failure.
- Check that the browser environment supports the fixture’s media format and that the node can access the media resource.
- Confirm that any BiDi-based diagnostics are supported by the exact browser and Selenium binding in use.
Or skip the browser setup
For capturing a page screenshot as part of a workflow, ScreenshotNeo offers a one-request screenshot API. It is not a replacement for Selenium assertions about playback, paused state, seeking, or buffering; it captures a page image or PDF.
cURL example (see the ScreenshotNeo API documentation):
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before the shot; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 shots.
Sign up for ScreenshotNeo’s free 1,000 screenshots a month—no card required.
Free tools Windows power users keep installed
One-click scans. No signup required.
Frequently Asked Questions
Can Selenium test a video hosted in a third-party embedded player?
It can interact with a frame when the page and browser permit access, but the provider’s player API and cross-origin behavior determine the right approach; no single method works for every embed.
Does Selenium prove a video looks or sounds good?
No. Selenium verifies browser and page behavior, not perceptual audio or picture quality, all hardware codec combinations, or sustained stream quality.
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.

