Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Selenium Wire adds network inspection to Selenium’s Python WebDriver: launch a browser, visit a page, and read its captured requests from driver.requests. It can also intercept requests and responses, but it routes browser traffic through an internal proxy, so it is an older, more involved tool than ordinary Selenium automation. The original Selenium Wire release, 5.1.0, dates to October 15, 2022; check compatibility carefully before using it in a current environment.
Install Selenium Wire and capture your first requests
Use a virtual environment so the browser-automation dependencies for this project do not affect other Python projects. Selenium Wire’s documented import path is seleniumwire; Selenium helpers such as WebDriverWait still come from selenium.webdriver.
-
Create and activate an environment. On macOS or Linux:
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 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteSpecial offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.python3 -m venv .venv source .venv/bin/activateOn Windows PowerShell, use
py -m venv .venvfollowed by.venvScriptsActivate.ps1. -
Install the package:
python -m pip install selenium-wire -
Save the following as
capture_requests.pyand run it withpython capture_requests.py:from seleniumwire import webdriver options = { "request_storage": "memory", "request_storage_max_size": 100, } driver = webdriver.Chrome(seleniumwire_options=options) try: driver.get("https://www.example.com") for request in driver.requests: if request.response: print( request.method, request.url, request.response.status_code, ) finally: driver.quit()
Selenium’s current Python guidance lists Python 3.10 or later and says Selenium Manager generally handles browser-driver setup when a WebDriver is created. That is guidance for Selenium itself, not proof that Selenium Wire 5.1.0 works with every current Python, Selenium, browser, or driver combination. Selenium Wire’s older setup instructions may instead mention manual driver installation. Start with Selenium’s current approach for the base WebDriver, then investigate a driver problem separately from a Selenium Wire compatibility problem.
The example stores captures in memory and caps the retained list at 100 requests. Remove the options argument to use Selenium Wire’s default storage behavior. The package’s default capture storage is beneath a .seleniumwire directory in the system temporary directory.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
What Selenium Wire captures and how to inspect it
Selenium Wire places an internal proxy between the browser and the network. It captures HTTP and HTTPS requests and their responses. The driver.requests collection is in chronological order; each request can expose its method, URL, headers, body, and response. A response can be absent—for example, if a request did not complete—so check it before reading response fields.
for request in driver.requests:
print("Request:", request.method, request.url)
print("Request headers:", request.headers)
if request.body:
print("Request body:", request.body[:500])
if request.response:
print("Status:", request.response.status_code)
print("Response headers:", request.response.headers)
print("Response body:", request.response.body[:500])
Response and request bodies are bytes. Decode them only when the content type and encoding make that appropriate; binary resources such as images are not text. Avoid printing or saving whole bodies indiscriminately: API traffic can contain personal information, session tokens, or other secrets.
Wait for an API call triggered by an action
For a specific interaction, use wait_for_request(pattern) rather than searching every captured request. It waits for a matching request that another browser action triggers; it does not cause that action itself. Match a stable part of the endpoint URL, and use Selenium’s normal wait tools for the page element.
from seleniumwire import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# Selenium Wire options may be passed here as in the earlier example.
driver = webdriver.Chrome()
try:
driver.get("https://www.example.com/products")
button = WebDriverWait(driver, 10).until(
EC.element_to_be_clickable((By.CSS_SELECTOR, "button.load-products"))
)
button.click()
request = driver.wait_for_request(r"/api/products")
print(request.method, request.url)
if request.response:
print(request.response.status_code)
finally:
driver.quit()
Replace the example page, selector, and endpoint with elements from a site you own or are authorized to test. driver.last_request is a convenience accessor for the most recently captured request; it can be None if no request has been recorded.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Rank #2
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
Limit what gets captured and stored
By default, Selenium Wire captures matching browser traffic broadly. Narrow capture when you need only a particular API or domain: set driver.scopes to a list of regular expressions matching URLs to retain.
driver.scopes = [r".*example.com/api/.*"]
A scope controls which requests are stored, not whether they travel through Selenium Wire’s proxy. For a host that should bypass Selenium Wire altogether, use exclude_hosts in the Selenium Wire options. Such hosts also bypass any upstream proxy configured in Selenium Wire.
options = {
"exclude_hosts": ["static.example.com"],
}
driver = webdriver.Chrome(seleniumwire_options=options)
For short runs, memory storage avoids writing capture data to the default temporary-directory location. Set request_storage_max_size along with request_storage: when the memory store reaches its limit, older requests are discarded. This makes it unsuitable if the test needs to retain a long history.
disable_capture disables interception and storage. Request interceptors do not execute while capture is disabled. Use it when a test needs to perform ordinary browser work without recording traffic, rather than expecting URL scopes to turn off the proxy.
Free tools Windows power users keep installed
One-click scans. No signup required.
-
Keep scopes specific enough to avoid storing unrelated page assets.
-
Keep the memory limit appropriate for the test; too low a limit can discard the request you need.
-
Do not commit capture directories, credentials, cookies, or logs containing sensitive request data to source control.
Rank #3
Intercept, change, block, or mock traffic
Assign driver.request_interceptor or driver.response_interceptor before the browser action that triggers the request. The request interceptor receives a request; the response interceptor receives both the request and response. Keep conditions narrow: these handlers affect live browser traffic, so a broad rewrite or abort can break unrelated scripts and page resources.
Add a request header
def add_test_header(request):
if "/api/" in request.url:
request.headers["X-Test-Run"] = "selenium"
driver.request_interceptor = add_test_header
driver.get("https://www.example.com")
Install the interceptor before calling get or clicking the control that starts the request. The condition above is illustrative; constrain it to the intended host and endpoint in real tests.
Abort a request
def block_analytics(request):
if "analytics.example.com" in request.host:
request.abort()
driver.request_interceptor = block_analytics
Aborting a request changes what the page experiences. Use it deliberately in a controlled test, not as a way to evade a site’s access controls.
Return a mock response
def mock_products(request):
if request.url.endswith("/api/products"):
request.create_response(
status_code=200,
headers={"Content-Type": "application/json"},
body='{"products": []}',
)
driver.request_interceptor = mock_products
A mock lets a test exercise page behavior without relying on the real API response. Ensure the body and headers match what the application expects; a syntactically valid response can still be the wrong shape for the client code.
Inspect or adjust a response
A response interceptor receives request and response, so it can be limited to a particular endpoint and inspect the returned status, headers, or body. Selenium Wire also documents response modification. Because altering response bodies can invalidate content-length or other headers and affect application behavior, change only what the test requires and verify the browser outcome.
Recommended Free Tools
HTTPS inspection, certificates, and upstream proxies
To inspect HTTPS traffic, Selenium Wire uses its own root certificate and configures the browser to accept it as an exception. Its documentation notes that the browser may display a “Not Secure” message. This is a consequence of the interception setup, not a general recommendation to disable certificate validation. Use the package’s documented certificate handling and limit interception to authorized test systems.
Selenium Wire also supports upstream proxy configuration, including HTTP, HTTPS, SOCKS variants, and authentication. Keep proxy credentials out of source files and logs; use protected environment or secret-management mechanisms in your own deployment. Be careful with exclude_hosts: excluded destinations bypass the configured upstream proxy as well as Selenium Wire.
Rank #4
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
Compatibility and maintenance: check before adopting
PyPI lists the original selenium-wire 5.1.0 release as October 15, 2022. Its documentation describes Python 3.7+, Selenium 4.0.0+, Chrome, Firefox, Edge, and Remote WebDriver, but those broad statements are not a tested compatibility matrix for today’s releases. Selenium’s current Python documentation lists Python 3.10+ and Chrome, Edge, Firefox, Safari, WebKitGTK, and WPEWebKit; that does not establish Selenium Wire compatibility with every browser Selenium supports.
A separate fork, selenium-wire-lw, has more recent releases; PyPI lists version 3.0.2 on January 10, 2026. Its maintainer, LunarWatcher, describes the fork as a response to the original package being abandoned and says the fork was needed for an archival project. That is the fork maintainer’s account, not an independently confirmed announcement from the original author. Before choosing the fork, check its current Python and Selenium requirements, browser support, licensing, security posture, and fit for your environment. A newer release date alone does not establish compatibility or suitability.
If you only need to automate clicks, fill forms, or verify rendered page content, ordinary Selenium avoids Selenium Wire’s extra proxy layer. Use Selenium Wire when inspecting or changing network traffic is itself part of the test, and validate a small representative case in the exact environment you plan to run.
Performance, reliability, and cost considerations
Selenium Wire adds proxying, capture, and potentially disk writes to the browser workflow. Capturing all traffic can add overhead and create a large volume of data; the sources do not establish a universal speed penalty. Limit scopes, use memory storage with a maximum size for short-lived runs, and avoid collecting bodies you do not need.
Browser tests are sensitive to page behavior, network conditions, and the compatibility of the browser, driver, Selenium, Python, and Selenium Wire versions. A request missing from the capture may have failed to load, fallen outside the scope, been bypassed through exclude_hosts, or occurred before the interceptor was attached. Distinguish those cases before treating the result as an application defect. Selenium Wire is an open-source package; no service price or usage quota is established by the cited package information.
Troubleshooting common problems
-
ModuleNotFoundError: No module named 'seleniumwire': The package is likely installed in a different interpreter environment. Activate the intended virtual environment and runpython -m pip show selenium-wirewith the samepythoncommand used to run the script.Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Chrome or another browser fails to start: First test a plain Selenium WebDriver in the same environment. Check that the browser is installed and that Selenium Manager can resolve its driver, or follow current Selenium guidance for your setup. A base browser startup failure does not by itself prove a Selenium Wire defect.
-
No request appears in
driver.requests: Confirm that navigation or the interaction actually triggered network traffic, that the URL matchesdriver.scopes, that capture is not disabled, and that the host is not excluded. Check that the script is inspecting the same live driver instance. -
wait_for_requestappears to hang or times out: It waits for a request caused by another action. Trigger the button click or navigation first, verify the endpoint pattern matches the actual URL, and use an explicit timeout where supported by the installed version. -
HTTPS page shows a security warning or fails: HTTPS inspection relies on Selenium Wire’s certificate setup. Check the package’s certificate configuration and browser trust behavior for your environment; do not solve the issue by broadly disabling certificate checks.
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 errorsSpecial offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Unexpectedly large temporary data or slow test: Narrow scopes, switch short-lived captures to bounded memory storage, or disable capture for browser work that does not need it. Remember scopes reduce stored requests but do not remove proxy traversal.
-
Interceptor has no effect: Set it before the relevant request is issued and confirm capture is enabled. Request interceptors do not execute when
disable_captureis active.
Or skip the browser setup
Selenium Wire is for automating a browser and inspecting its network traffic. If the task is simply to produce a screenshot or PDF of a URL, ScreenshotNeo is a separate API and MCP server rather than a Selenium network-inspection replacement. A single request can capture an image or PDF without configuring a local browser. See the ScreenshotNeo website and API documentation.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
It removes cookie banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, and failed loads are never billed. Its MCP server lets AI agents take screenshots, and the free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000. Sign up for 1,000 free screenshots a month, with no card required.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Repair Windows errors before they cause bigger problemsFix Now →Frequently Asked Questions
Can I use Selenium Wire to capture traffic from a site I do not control?
Use browser interception only on systems you own or are authorized to test. It can expose credentials, cookies, and other sensitive request data.
Does Selenium Wire replace Selenium?
No. It extends Selenium’s Python WebDriver with traffic capture and interception; browser navigation and interaction still use Selenium.
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.

