For new Selenium projects, use WebDriver BiDi: enable BiDi in the browser options, register a network listener before the action under test, then navigate or click and record the events. BiDi can observe requests and responses across browsers that implement the relevant APIs. Use Selenium’s CDP integration when you specifically target Chrome or Edge and need an existing Chromium-specific interceptor, but pin compatible browser and Selenium versions because CDP is version-sensitive.
Decide what “capture” means
Network capture can describe three different jobs. Choose one before writing the test:
- Observe: receive lifecycle events such as an outgoing request, response start, response completion, or a fetch error without changing traffic.
- Intercept a request: inspect or change outgoing headers or the request body, or block the request.
- Intercept a response: inspect or change response headers, status, or content before the page receives it.
Observation is appropriate for logging, assertions, and diagnostics. Interception changes the path being tested, so use it only when the test intentionally needs mocked, blocked, or modified traffic.
Use WebDriver BiDi for a new implementation
WebDriver BiDi is Selenium’s standards-based, bidirectional protocol. It adds a WebSocket through which the driver can receive browser events, including network events. Selenium positions BiDi as the forward-looking replacement for temporary, browser-specific CDP integrations. Actual event support still depends on the browser, driver, binding, and Selenium release.
Recommended Free Tools
#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.
Prerequisites
- Install a current Selenium binding and a browser/driver combination that supports the BiDi features you need.
- Enable BiDi in the binding’s browser options before creating the driver. In Python, the option is exposed as
options.enable_bidi = Truein current Selenium releases. - Register listeners before navigation or the click that generates the traffic. Event streams are not a substitute for a request log captured after the fact; an event emitted before subscription can be missed.
- Record the Selenium and browser versions with your test results. BiDi method names and callback signatures vary by language binding and release.
Python: observe request and response lifecycle events
The following example targets the Selenium Python 4.43.0 API shape. It enables BiDi, attaches handlers for the four network event types documented by that release, performs an action, and prints useful fields. If your installed binding exposes the same methods under a slightly different module path, use its generated API reference rather than silently mixing examples from another release.
import json
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.bidi.modules.network import NetworkEvent
options = Options()
options.enable_bidi = True
driver = webdriver.Chrome(options=options)
# Keep handlers registered before the action that creates requests.
def before_request(event):
request = event.get("request", event)
print(json.dumps({
"event": "beforeRequestSent",
"request_id": request.get("request", request.get("requestId")),
"url": request.get("url"),
"method": request.get("method"),
"headers": request.get("headers"),
}, default=str))
def response_started(event):
response = event.get("response", event)
print(json.dumps({
"event": "responseStarted",
"request_id": response.get("request"),
"status": response.get("status"),
"url": response.get("url"),
"headers": response.get("headers"),
}, default=str))
def response_completed(event):
response = event.get("response", event)
print(json.dumps({
"event": "responseCompleted",
"request_id": response.get("request"),
"status": response.get("status"),
"url": response.get("url"),
}, default=str))
def fetch_error(event):
print(json.dumps({"event": "fetchError", "details": event}, default=str))
try:
# The Python 4.43.0 network API accepts an event, callback,
# optional URL patterns, and optional browsing contexts.
driver.network.add_request_handler(
NetworkEvent.BEFORE_REQUEST_SENT, before_request)
driver.network.add_request_handler(
NetworkEvent.RESPONSE_STARTED, response_started)
driver.network.add_request_handler(
NetworkEvent.RESPONSE_COMPLETED, response_completed)
driver.network.add_request_handler(
NetworkEvent.FETCH_ERROR, fetch_error)
driver.get("https://example.com/")
driver.find_element("tag name", "body").click()
finally:
driver.quit()
Event objects are binding-defined structures. Some releases provide typed event objects rather than dictionaries, and asynchronous bindings may require an async callback. Treat the event names and registration call as the 4.43.0 reference point, then check the API reference for your installed version. A handler can also receive URL patterns or browsing-context filters when you need to reduce noise.
Capture only the URLs you care about
Filtering at subscription time is preferable to collecting every image, stylesheet, and analytics request. Supply URL patterns where your binding supports them, for example an API hostname or path pattern. If your binding does not expose pattern filtering, filter in the callback and keep the original URL, method, status, and request identifier so related events can be joined later.
def api_request(event):
request = event.get("request", event)
url = request.get("url", "")
if "/api/" not in url:
return
print(request.get("method"), url, request.get("headers"))
# Use the optional pattern argument when supported by your release:
# driver.network.add_request_handler(
# NetworkEvent.BEFORE_REQUEST_SENT, api_request,
# url_patterns=["*://example.com/api/*"])
Correlate a request with its response
Store events by their request identifier. A single page action can create redirects, preflight requests, retries, and parallel resources, so URL alone is not a reliable key. Keep a record containing method, URL, timestamps, status, headers, and any error. A completed response is not guaranteed: a blocked request, navigation cancellation, or network failure may produce a fetch-error event instead.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteIntercept and modify traffic with BiDi
Use a request handler when the test must change outgoing traffic. Typical examples include adding a deterministic authorization header, replacing a request body, or blocking a third-party URL. Use a response handler when the test must inspect or alter an incoming status, header, or body. The exact continuation and mutation methods differ between Selenium bindings, so do not copy a JavaScript, Java, and Python handler interchangeably.
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.
- Enable BiDi in browser options.
- Register the request or response handler before navigation.
- Limit the handler to URL patterns or a browsing context where possible.
- Explicitly continue unmodified traffic; an interception that never resumes can make the page hang.
- Remove the handler after the test or close the driver so it cannot affect another case.
Interception is not passive capture. Assertions made after a modified request describe the modified scenario, not the application’s unaltered behavior. Keep separate tests for observation and mocking.
When CDP is the practical fallback
Selenium exposes Chrome DevTools Protocol functionality and documents a NetworkInterceptor example. CDP is appropriate when your test is intentionally Chrome- or Edge-only, when an existing Chromium interceptor already does the job, or when the BiDi feature you need is not implemented by your browser yet.
- Browser reach: BiDi is the cross-browser direction; CDP is tied to Chromium’s DevTools protocol.
- Maintenance: Selenium describes CDP access as temporary while BiDi is implemented and warns that support depends heavily on browser version.
- Migration: Pin Selenium, the browser, and the driver together, and expect CDP code to need changes as versions move.
Do not select CDP merely because a snippet is older or easier to find. For a new cross-browser test, start with BiDi and use CDP only for a documented compatibility reason.
Free tools Windows power users keep installed
One-click scans. No signup required.
Make captures useful in real tests
Register before the trigger
Create the driver, enable the protocol, and register handlers before get(), clicking a login button, submitting a form, or opening a new tab. If you attach after the action, you may see only later requests.
Keep the log bounded
Write newline-delimited JSON or a structured test attachment instead of printing entire bodies to standard output. Filter static assets, redact authorization and cookie headers, and cap body size. Network logs can contain passwords, session tokens, personal data, and proprietary responses.
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.
Allow asynchronous delivery
Event delivery is asynchronous. Wait for the specific request or response your assertion needs rather than sleeping for an arbitrary number of seconds. A robust wait checks request URL and method, then status or error, with a timeout that fails the test clearly.
Account for browser behavior
- CORS can create an OPTIONS preflight before the actual request.
- Service workers may satisfy a request without a normal network trip.
- Redirects create multiple lifecycle records.
- Cached resources may produce fewer network events than a cold profile.
- Opening a new tab or frame may require a browsing-context filter or separate correlation key.
- Headless and headed modes can differ in timing, caching, and browser feature support.
Troubleshooting
No events appear
Confirm that BiDi was enabled before driver creation, the browser and driver support the requested event, and the listener was registered before navigation. Verify that your callback is still alive and that an overly narrow URL pattern is not excluding the request. Try a simple uncached page and log every event temporarily.
The code fails with an unknown option or method
Your Selenium binding or release has a different API surface. Check the installed version, consult that binding’s BiDi network reference, and do not assume Python 4.43.0 names apply to Java, JavaScript, .NET, or an older Python package.
Only some requests are captured
Check for preflight, redirects, service-worker responses, cache hits, and requests from another browsing context. Remove filters, record request identifiers, and compare the event sequence with the browser’s own network panel while diagnosing.
The page hangs after interception
The handler probably did not continue the request or response on every code path. Add an explicit pass-through branch, keep mutation logic small, and remove the interceptor after the assertion.
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
CDP works locally but fails in CI
Align browser, driver, and Selenium versions in the CI image. A CDP domain or command can change with the browser version. If the required capability exists in BiDi, migrate instead of adding more version-specific branching.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Or skip the browser setup
If your actual deliverable is a clean visual capture rather than request-level assertions, ScreenshotNeo provides a single HTTP request. It is a screenshot API and MCP server, not a replacement for Selenium network telemetry: use Selenium when you must inspect or modify traffic. ScreenshotNeo is useful when you need a page image or PDF without maintaining browser startup and cleanup.
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 documentation for options. Before capture it accepts cookie or consent banners 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 result. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 screenshots; every feature is included on every plan. Create a free ScreenshotNeo account to try it.
FAQ
Does Selenium save a HAR file automatically?
Not from the BiDi event subscription alone. Build the HAR-like structure your test needs from request and response events, or use a separate proxy when a standards-compliant HAR export is a requirement.
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 matchCan I capture HTTPS requests?
Browser automation receives network metadata after the browser processes TLS; it does not require you to decrypt traffic with a separate man-in-the-middle proxy. The exact response-body and certificate details available depend on the browser and binding implementation.
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.
Should I use performance logs instead?
Performance-log techniques are Chromium-specific and provide a different, older integration surface. For a new cross-browser design, prefer BiDi; retain an existing performance-log or CDP implementation only when its browser constraints are acceptable.
Frequently Asked Questions
Does Selenium save a HAR file automatically?
Not from BiDi subscriptions alone. Assemble the records you need from events or use a dedicated proxy when HAR export is required.
Can I capture HTTPS requests?
The browser exposes supported network metadata after TLS processing; available fields vary by browser and Selenium binding.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Should I use performance logs instead of BiDi?
Performance logs are Chromium-specific. Prefer BiDi for new cross-browser work, keeping older integrations only when their constraints are acceptable.
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.

