Nodriver usually stops working on Cloudflare for one of three reasons: Chrome never starts (a sandbox, display or path problem), the challenge needs a checkbox click that nodriver does not make on its own, or Cloudflare scores the session as automated because of headless mode or the IP address. Fix the start-up error first, then run headed, wait, call tab.verify_cf() once, and test from a cleaner IP. If you need this at scale, replace the browser step with a managed challenge solver.
Nodriver (ultrafunkamsterdam/nodriver) is the official successor of undetected-chromedriver: it drops Selenium and ChromeDriver and talks to Chrome directly over the DevTools Protocol. That removes a lot of automation fingerprints, but it does not make a browser invisible, and the 2026 release train (0.50.x moved to flat-mode connections and asks users to test thoroughly) has added new ways for scripts to break. Below: every common failure, the fix in nodriver itself, the zendriver fork, and when to stop fighting the browser.
Quick answer: match your nodriver error to the fix
Most nodriver failures are one of these messages or symptoms. Find yours, then read the matching section below for code.
- Failed to connect to browser. One of the causes could be when you are running as root.
- Chrome never opened its debugging endpoint. Pass sandbox=False (no_sandbox=True, which the message suggests, is not a start() parameter). Also check the Chrome install or browser_executable_path, and give a headed browser a display (Xvfb on servers).
- Stuck on "Just a moment..." / page title never changes
- Cloudflare did not clear the challenge. Run headed, wait a few seconds, click the checkbox if one appears (tab.verify_cf()), and test from a cleaner IP. Headless mode and datacenter IPs are the usual causes.
- AttributeError: 'Tab' object has no attribute 'cf_verify'
- Wrong method name. The README calls it tab.cf_verify(), but the method in nodriver's source is tab.verify_cf(). Use await tab.verify_cf().
- TypeError: cannot unpack non-iterable NoneType object (from verify_cf)
- The checkbox image was not found on screen. verify_cf() is an OpenCV template match: install opencv-python, run from a writable working directory (it saves screen.jpg there), and pass your own template_image for non-English widgets.
- this function is useless in expert mode
- verify_cf() refuses to run with expert=True. Start without expert=True; nodriver itself warns that expert mode makes you more detectable.
- cf_clearance missing, or 403 when reusing it in requests
- The challenge never passed, or the cookie was replayed out of context. Poll browser.cookies.get_all() until cf_clearance exists, then reuse it with the same User-Agent and the same exit IP. A different HTTP client also has a different TLS fingerprint.
- Works headed, blocked in headless=True
- Headless Chrome still leaks tells. zendriver's 0.18.0 changelog documents two: missing client hints after the UA override, and cross-site iframes (the challenge) still seeing HeadlessChrome. Run headed under Xvfb, or try zendriver 0.18+ with a screen setting.
- Turnstile widget on a form never turns green
- No token was produced for cf-turnstile-response. Try verify_cf() on the widget; if the site keeps rejecting the browser, get a token from a solver API (type turnstile) and submit it as cf-turnstile-response.
Why nodriver gets stuck on Cloudflare
Before changing code, identify which layer is failing. Nodriver controls a real Chrome, so the JavaScript challenge does run. What it cannot control is how Cloudflare scores that browser and where its traffic comes from.
- Interactive checkboxes. When a managed challenge or a Turnstile widget asks for a click, nodriver only loads the page. Its helper, tab.verify_cf(), finds the checkbox by matching a screenshot against a bundled image with OpenCV, and the bundled template is English only.
- Headless tells. headless=True launches Chrome with --headless=new and nodriver rewrites the user agent to remove "Headless". The zendriver fork, which shares nodriver's code base, documented in its 0.18.0 release that this override dropped the Sec-CH-UA client hints and that cross-site iframes (typically the challenge) still saw HeadlessChrome. Chrome's headless 800x600 virtual screen is another tell.
- IP reputation. A clean browser on a datacenter or heavily shared proxy IP can still loop on "Just a moment..." forever, because the score is not only about the browser.
- Version churn. Version 0.50.1 rewrote parts of nodriver to use flat-mode connections, and the README asks you to "test thoroughly, especially if you run large projects". PyPI shows 0.50.99 published on 2026-10-26. An unpinned pip install can change behaviour between two deploys.
- Slow upstream fixes. zendriver was forked because, in its own words, contributions to nodriver are heavily restricted and critical bug-fix pull requests sat unaddressed for months.
Fix 1: "Failed to connect to browser" and Chrome that will not start
This exception is raised when nodriver cannot reach Chrome's /json/version endpoint after five attempts. The message suggests no_sandbox=True, but start() and Config take a sandbox argument: sandbox=False adds --no-sandbox. Extra keyword arguments such as no_sandbox are only stored as attributes, so they change nothing. zendriver corrected this misleading hint in 0.17.1. On Linux, nodriver already disables the sandbox automatically when it detects root, so if you still see the error as root, look elsewhere.
The other causes, in order: Chrome is not installed in a default location (the README says Chrome must be installed on the machine; set browser_executable_path), a headed browser has no display on a server (use Xvfb, which the README recommends for AWS and similar hosts), or a pinned nodriver version does not match the installed Chrome. Nodriver already passes --disable-dev-shm-usage, so Docker shared memory is rarely the culprit.
import nodriver as uc
async def main():
browser = await uc.start(
headless=False, # headed; on a server run it inside Xvfb (xvfb-run python app.py)
sandbox=False, # adds --no-sandbox; "no_sandbox=True" is not a start() option
lang="en-US",
# browser_executable_path="/usr/bin/google-chrome", # if Chrome is not auto-detected
)
tab = await browser.get("https://example.com")
print(await tab.evaluate("navigator.userAgent"))
browser.stop()
if __name__ == "__main__":
uc.loop().run_until_complete(main())Fix 2: stuck on "Just a moment...": run headed, wait, click once
In a real headed browser the non-interactive challenge often clears by itself within a few seconds; the checkbox only matters when Cloudflare escalates to an interactive one. So the reliable pattern is: open the page in a headed browser, wait for cf_clearance to appear in the cookie jar, and only if the title is still "Just a moment..." after a few seconds, call verify_cf() once. Clicking instantly or repeatedly looks more automated.
Know verify_cf()'s limits from its source: it saves screen.jpg and cf_template.png into the current working directory and returns no coordinates if OpenCV is missing or the directory is read-only, which then surfaces as a TypeError. It raises an exception in expert mode. For a non-English widget, pass template_image with your own 111x71 crop centred on the checkbox. Since 0.50.1, tab.find() also searches inside iframes, so await tab.find("verify you are human") can locate the label text in the challenge frame.
import nodriver as uc
TARGET = "https://example.com/"
async def wait_for_clearance(browser, tab, timeout=30):
"""Wait for cf_clearance; click the checkbox once if the challenge asks for it."""
clicked = False
for second in range(timeout):
cookies = await browser.cookies.get_all()
if any(c.name == "cf_clearance" for c in cookies):
return True
title = await tab.evaluate("document.title")
if not clicked and second >= 5 and "Just a moment" in str(title):
try:
# Image match (needs: pip install opencv-python). Writes screen.jpg
# and cf_template.png to the working directory, which must be writable.
await tab.verify_cf()
clicked = True
except TypeError:
print("checkbox not found on screen (OpenCV missing, read-only cwd, or no match)")
await tab.sleep(1)
return False
async def main():
browser = await uc.start(headless=False, sandbox=False)
tab = await browser.get(TARGET)
if await wait_for_clearance(browser, tab):
ua = await tab.evaluate("navigator.userAgent")
jar = await browser.cookies.get_all(requests_cookie_format=True)
print("cleared with UA:", ua, "cookies:", [c.name for c in jar])
browser.stop()
if __name__ == "__main__":
uc.loop().run_until_complete(main())Fix 3: cf_clearance not set, or rejected when you reuse it
If browser.cookies.get_all() never returns cf_clearance, the challenge did not pass: go back to Fix 2 and the IP. If the cookie exists but your requests code still gets a 403 or a new challenge, the replay is the problem, not nodriver.
- Same User-Agent: read navigator.userAgent from the tab that cleared the challenge and send exactly that string.
- Same exit IP: send the replay through the same proxy as the browser. For authenticated proxies, nodriver's browser.create_context(url, proxy_server=...) runs a local forwarder (socks://USERNAME:PASSWORD@SERVER:PORT for SOCKS with auth), because Chrome's --proxy-server flag cannot carry credentials.
- Same client where possible: get_all(requests_cookie_format=True) returns http.cookiejar cookies for requests, but a Python HTTP client does not have Chrome's TLS fingerprint. Doing the follow-up requests inside the same nodriver tab avoids that mismatch.
- Expiry: the clearance lasts as long as the site owner's Challenge Passage setting. Our cf_clearance guide explains what the cookie is bound to.
Zendriver: the maintained fork to try first
Zendriver (cdpdriver/zendriver) is a fork of nodriver created to merge the open pull requests, add static typing and accept community contributions. The API is close enough that most scripts only change the import: pip install zendriver, then import zendriver as zd and await zd.start(). It requires Python 3.10 or newer (PyPI, version 0.18.0 of 2026-11-21). Both projects are AGPL-3.0, which matters if you ship them inside a commercial product.
For Cloudflare, three zendriver changes are relevant. Its verify_cf() is DOM-based instead of image-based: it walks the shadow roots for the challenges.cloudflare.com iframe, clicks near the checkbox and raises TimeoutError if no visible checkbox appears, so OpenCV and screen language no longer matter. Version 0.18.0 fixed the two headless leaks described above and added a screen option (Screen(1920, 1080)) to replace Chrome's 800x600 headless screen on Chrome 142+. And Browser.create_context() supports authenticated HTTP, HTTPS and SOCKS5 proxies.
import asyncio
import zendriver as zd
async def main():
browser = await zd.start(headless=False, sandbox=False)
tab = await browser.get("https://example.com/")
try:
# DOM-based: finds the challenge iframe inside the shadow root and clicks it.
await tab.verify_cf(timeout=15)
except TimeoutError:
print("no interactive checkbox appeared (or it never became visible)")
await tab.sleep(5)
print(await tab.evaluate("document.title"))
await browser.stop()
if __name__ == "__main__":
asyncio.run(main())When to stop tuning the browser
Nodriver and zendriver are the right tools when you need a real browser session and run a handful of them. They become the wrong layer when the same page still loops after the fixes above, when every Cloudflare or Chrome update breaks a deploy, or when you are paying for servers, Xvfb and residential proxies just to obtain one cookie per site.
At that point, move only the challenge step to a managed solver: it returns the cf_clearance cookie (or a Turnstile token) over HTTP, and your scraper keeps everything else. Only automate sites you own or are explicitly authorised to access, and respect their terms and rate limits.
NSLSolver example: cf_clearance without launching Chrome
NSLSolver's challenge type takes the page url, the challenge site_key and your proxy, and returns cookies (including cf_clearance) plus the user_agent to replay through the same proxy. Leave user_agent out of the request: the clearance is issued for an iPhone Safari User-Agent, so replay it with the returned UA from a plain HTTP client rather than inside a desktop nodriver session. Challenge solves take about 3.3 s on average and cost $1.00 per 1,000; only successful solves are billed, and sign-ups with Google, Gmail or Proton get free credit with no card.
If the wall is a Turnstile widget on a form rather than a full-page challenge, use type turnstile with the widget's site_key and url (about 250 ms, $0.80 per 1,000) and submit the returned token as cf-turnstile-response. NSLSolver does not solve reCAPTCHA v2, hCaptcha, image CAPTCHAs or DataDome, so keep the browser for those.
import requests
API_KEY = "nsl_YOUR_API_KEY"
TARGET = "https://target-site.com/"
PROXY = "http://user:pass@sticky-proxy.example.com:8080" # same exit IP for solve AND replay
SITE_KEY = "0x4AAAAAAA..." # the challenge widget id (0x...) from the challenge page
# 1) One HTTP call replaces the browser launch + wait + checkbox click
resp = requests.post(
"https://api.nslsolver.com/solve",
headers={"X-API-Key": API_KEY},
json={
"type": "challenge",
"url": TARGET,
"site_key": SITE_KEY,
"proxy": PROXY,
# user_agent omitted: the clearance is issued for the solver's iPhone
# Safari browser, and the matching UA comes back in the response
},
timeout=120,
)
resp.raise_for_status()
data = resp.json()
# 2) Replay cf_clearance with the returned user_agent through the SAME proxy
session = requests.Session()
session.proxies = {"http": PROXY, "https": PROXY}
session.cookies.update(data["cookies"]) # includes cf_clearance
session.headers["User-Agent"] = data["user_agent"]
page = session.get(TARGET, timeout=30)
print(page.status_code, page.headers.get("cf-mitigated"))Related: the Cloudflare Challenge solver API for integration details, pay-per-success pricing, undetected-chromedriver not working if you are still on nodriver's predecessor, the cf_clearance cookie guide for replay rules, and FlareSolverr not working if you run a proxy-style solver.