Skip to content
Guide

selenium-wire Not Working on Cloudflare: Why Undetected Mode Gets Caught and What to Use Instead

NSLSolver TeamPublished Updated 9 min read

selenium-wire gets caught by Cloudflare even with undetected-chromedriver because of how it works. To capture HTTPS traffic it sits in the middle as a proxy, decrypts the browser's connection and opens its own connection to the site, so Cloudflare sees selenium-wire's TLS handshake instead of Chrome's. Its author confirmed this in issue #577: "It's during this upstream handshake that Cloud Flare can see Selenium Wire."

On top of that, the project was archived on 2024-01-03 ("Selenium Wire is no longer being maintained"), so modern Python and dependencies break its install. This guide covers the fixes that still work: pinning dependencies, disable_capture, certificate and proxy errors. It also covers replacements for what you used selenium-wire for, and requests-html, which shares the problem. Facts are from the repos, PyPI and issues, checked 2026-12-01.

Quick answer: match your error to the fix

selenium-wire errors fall into two groups: install breakage on modern Python, and detection. Find yours below.

ModuleNotFoundError: No module named 'blinker._saferef'
blinker 1.8 (April 2024) removed a module selenium-wire's bundled mitmproxy imports. pip install "blinker==1.7.0".
ModuleNotFoundError: No module named 'pkg_resources'
selenium-wire imports pkg_resources; Python 3.12 venvs no longer include setuptools, and setuptools 82 removed pkg_resources. pip install "setuptools<82".
ModuleNotFoundError: No module named 'distutils'
undetected-chromedriver 3.5.5 imports distutils, removed in Python 3.12. Install setuptools (it provides a distutils shim), or move off undetected-chromedriver.
Vanilla undetected-chromedriver passes Cloudflare, seleniumwire.undetected_chromedriver does not
selenium-wire's upstream TLS handshake is visible to Cloudflare (issue #577). Set disable_capture, or drop selenium-wire and use a proxy method that does not decrypt traffic.
"Your connection is not private" / "Not Secure" in the address bar
Pages are signed by selenium-wire's own root certificate (issues #685, #120). Expected with interception; install its CA certificate if you must keep capture on.
net::ERR_PROXY_CONNECTION_FAILED
Chrome cannot reach selenium-wire's local proxy, or it cannot reach your upstream proxy (issues #470, #425, #719). Check the upstream proxy URL and credentials, and that nothing blocks the local port (common in CI).
OSError: Chromium downloadable not found at https://storage.googleapis.com/chromium-browser-snapshots/...
requests-html's pyppeteer cannot download its pinned Chromium (requests-html #571). requests-html (last release 2019) and pyppeteer are unmaintained; move to Playwright.
ImportError: lxml.html.clean module is now a separate project lxml_html_clean
lxml 5.2 split a module requests-html imports (#569). pip install lxml_html_clean.

Errors are quoted from GitHub issues (selenium-wire, SeleniumBase #2782, requests-html) and verified against the selenium-wire 5.1.0 and undetected-chromedriver 3.5.5 sources, checked 2026-12-01.

Running undetected-chromedriver without selenium-wire and still blocked? See undetected-chromedriver not working in 2026 →

Why Cloudflare catches selenium-wire

selenium-wire (github.com/wkeeling/selenium-wire, MIT) was the easy way to read requests and use authenticated proxies from Selenium. It works by running a local mitmproxy-based proxy. Its README says it "uses it's own root certificate to decrypt HTTPS traffic". The browser completes its TLS handshake with selenium-wire, and selenium-wire opens a second connection to the website.

That second connection is the problem. Cloudflare reads the TLS fingerprint of whoever connects to it, and here that is selenium-wire's Python stack, not Chrome. The author spelled it out in several issues: "Selenium Wire presents a different TLS fingerprint than a browser due to the way it uses HTTPS interception behind the scenes" (#215), and in #577, titled "Using vanilla undetected chromedriver can get through CloudFlare, while selenium-wire UC cannot": "Sadly there's no solution at the current time." The undetected_chromedriver integration patches the browser, but it cannot change a handshake the browser never makes.

Fix 1: make it install and import on modern Python

The repository was archived on 2024-01-03, and its last PyPI release is 5.1.0 from October 2022. Three later changes break it. blinker 1.8.0 removed blinker._saferef, which the bundled mitmproxy imports. Python 3.12 venvs no longer pre-install setuptools. setuptools 82.0.0 removed pkg_resources, which selenium-wire still imports. undetected-chromedriver 3.5.5, its usual companion, imports distutils, which Python 3.12 removed. SeleniumBase issue #2782 documents the blinker fix. Pin all three:

pins.sh
# selenium-wire 5.1.0 (Oct 2022) was never updated for these changes:
#  - blinker 1.8 (Apr 2024) removed blinker._saferef, which selenium-wire's bundled mitmproxy imports
#  - Python 3.12 venvs no longer pre-install setuptools (pkg_resources, distutils)
#  - setuptools 82 (Feb 2026) removed pkg_resources
pip install "selenium-wire==5.1.0" "blinker==1.7.0" "setuptools<82"

# Quick check that the import chain loads
python -c "import seleniumwire.undetected_chromedriver as uc; print('ok')"

Fix 2: keep the proxy, stop the decryption (disable_capture)

If you only kept selenium-wire for an authenticated upstream proxy, you can stop it from intercepting. The author suggested this in #215: disabling request capture with the disable_capture option "will also disable HTTPS decryption". Chrome's own handshake then reaches the site through the tunnel. You lose driver.requests, and it does not make Chrome itself undetectable, but it removes the selenium-wire fingerprint. Test it on your target; there is no maintainer left to fix regressions.

proxy_only.py
import seleniumwire.undetected_chromedriver as uc

PROXY = "http://user:pass@proxy.example.com:8080"

seleniumwire_options = {
    "proxy": {"http": PROXY, "https": PROXY, "no_proxy": "localhost,127.0.0.1"},
    # No request capture = no HTTPS decryption (maintainer, issue #215), so the
    # TLS handshake the site sees is Chrome's own instead of selenium-wire's.
    # Trade-off: driver.requests stays empty.
    "disable_capture": True,
}

driver = uc.Chrome(options=uc.ChromeOptions(), seleniumwire_options=seleniumwire_options)
try:
    driver.get("https://target-site.com/")
    print(driver.title)
finally:
    driver.quit()

Fix 3: certificate warnings and proxy connection errors

  • "Not Secure" or "Your connection is not private": with capture on, every page is signed by selenium-wire's CA. That is how interception works, not a bug. Install its root certificate in the browser profile if you need clean pages, or use disable_capture.
  • net::ERR_PROXY_CONNECTION_FAILED: either Chrome cannot reach selenium-wire's local proxy (firewalled ports in CI, issue #719) or selenium-wire cannot reach your upstream proxy (wrong scheme, credentials or host, #470 and #425). Test the upstream proxy with curl first.
  • Set no_proxy for localhost so Chrome's own driver traffic does not go through the upstream proxy.
  • Forks such as selenium-wire-2 (0.2.1, July 2024, built on mitmproxy 10.3 or newer) and selenium-wire-lw (3.0.2, January 2026) exist and address some install problems. selenium-wire-2 still intercepts through mitmproxy, so the TLS point above still applies; check how any fork handles TLS before relying on it for Cloudflare.

Replace selenium-wire for what you actually used it for

Most projects used selenium-wire for one of two things. Each now has an option that does not put a decrypting proxy between Chrome and the site:

  • Authenticated proxies: SeleniumBase takes proxy="USER:PASS@SERVER:PORT" directly and combines it with UC Mode and CDP Mode, the successor to plain UC Mode in its docs (SeleniumBase 4.59.2, 2026-11-29). See our SeleniumBase UC Mode guide if it still gets challenged.
  • Reading or changing requests: Selenium 4's own network features. Chrome's DevTools Protocol is available through driver.execute_cdp_cmd, and Selenium 4.32 added a BiDi network implementation of intercepts and auth for Python. Check Selenium's BiDi network documentation for the API in your version.
  • Not Selenium-bound? nodriver and Playwright-based tools talk to the browser over CDP with no interception proxy.
seleniumbase_proxy.py
# pip install -U seleniumbase
from seleniumbase import SB

URL = "https://target-site.com/"

# Authenticated proxy without a man-in-the-middle proxy in the path
with SB(uc=True, proxy="user:pass@proxy.example.com:8080", locale="en") as sb:
    sb.activate_cdp_mode(URL)
    sb.solve_captcha()          # only acts if a CAPTCHA is still on the page
    print(sb.get_title())

requests-html: same era, same problem

requests-html is often found next to selenium-wire in older scraping tutorials. Its last release is 0.10.0 from February 2019. Its rendering depends on pyppeteer, whose README now says "This repo is unmaintained" and recommends playwright-python. The two errors people hit today are the Chromium download failing ("OSError: Chromium downloadable not found ...", #571) and lxml 5.2 splitting out lxml_html_clean (#569, fixed with pip install lxml_html_clean). Even when it runs, its old headless Chromium is easy for Cloudflare to spot. Move rendering to Playwright, or skip the browser for Cloudflare pages entirely (below).

When an API is simpler: Turnstile tokens for your Selenium flow

A common reason to keep a browser is a login or signup form behind a Cloudflare Turnstile widget. NSLSolver solves Turnstile server-side, with no browser of its own: POST the site key and page URL to https://api.nslsolver.com/solve and you get a token in about 250 ms on average, for $0.80 per 1,000 solves, billed only on success. Put it in the cf-turnstile-response field (and call the widget's callback if the site uses one) before submitting. Tokens are valid for 300 seconds and meant for single use, per Cloudflare's docs.

For full-page "Just a moment..." challenges, the Cloudflare Challenge solver returns a cf_clearance cookie and user_agent ($1.00 per 1,000, about 3.3 s). The clearance is issued for an iPhone Safari browser, so replay it with a matching HTTP client (see the cf_clearance guide) rather than injecting it into desktop Chrome. Sign-ups with Google, Gmail or Proton get free trial credit. Only automate sites you own or are authorised to access.

selenium_turnstile.py
import json

import requests
import seleniumwire.undetected_chromedriver as uc  # or plain selenium / SeleniumBase

URL = "https://target-site.com/login"

driver = uc.Chrome(options=uc.ChromeOptions(), seleniumwire_options={"disable_capture": True})
driver.get(URL)

site_key = driver.find_element("css selector", "[data-sitekey]").get_attribute("data-sitekey")

# One POST, about 250 ms on average, no second browser
token = requests.post(
    "https://api.nslsolver.com/solve",
    headers={"X-API-Key": "YOUR_API_KEY"},
    json={"type": "turnstile", "site_key": site_key, "url": URL},
    timeout=120,
).json()["token"]

# Put the token where the form expects it (valid 300 s, single use)
driver.execute_script("""
  let input = document.querySelector('[name="cf-turnstile-response"]');
  if (!input) {
    input = Object.assign(document.createElement('input'), {type: 'hidden', name: 'cf-turnstile-response'});
    document.querySelector('form')?.appendChild(input);
  }
  input.value = arguments[0];
""", token)

callback = driver.find_element("css selector", "[data-sitekey]").get_attribute("data-callback")
if callback:  # some sites only submit from the widget's callback
    driver.execute_script("window[arguments[0]](arguments[1])", callback, token)

driver.find_element("css selector", "button[type=submit]").click()
print(json.dumps({"title": driver.title}))
driver.quit()

Full /solve API reference

Related guides

Frequently asked questions

Why does seleniumwire.undetected_chromedriver get detected by Cloudflare?

Because selenium-wire decrypts HTTPS as a man-in-the-middle proxy and makes its own upstream TLS connection to the site. Cloudflare sees that handshake, not Chrome's. The author confirmed it in issues #215, #566 and #577; undetected-chromedriver cannot change a handshake the browser no longer makes.

Is selenium-wire still maintained?

No. The repository was archived on 2024-01-03 and its README starts with "Selenium Wire is no longer being maintained." The last PyPI release is 5.1.0 from October 2022.

How do I fix "No module named 'blinker._saferef'"?

Install blinker 1.7.0 (pip install "blinker==1.7.0"). blinker 1.8 removed the module that selenium-wire's bundled mitmproxy imports. On Python 3.12 you will usually also need "setuptools<82" for pkg_resources.

Can I use selenium-wire only for proxy authentication without being detected?

Setting disable_capture turns off HTTPS decryption according to the author (#215), so Chrome's own handshake reaches the site while the upstream proxy still works. You lose request capture. SeleniumBase's proxy="user:pass@host:port" option is a maintained alternative.

What should I use instead of selenium-wire?

For authenticated proxies, SeleniumBase with UC or CDP Mode. For request inspection, Selenium 4's CDP and BiDi network features. For Cloudflare widgets on forms, a Turnstile token from a solver API avoids the problem entirely.

Does NSLSolver work with Selenium?

Yes. Read the data-sitekey from the page, POST it with the URL to /solve as type turnstile, and set the returned token in cf-turnstile-response (or pass it to the widget's callback). It takes about 250 ms and costs $0.80 per 1,000 successful solves.

Turnstile on your form? Get the token by API

Keep Selenium for the flow and let NSLSolver return the Turnstile token: about 250 ms, $0.80 per 1,000, failed solves free. Free credit with Google, Gmail or Proton sign-up, no card needed.