Skip to content
Guide

Zendriver Not Working on Cloudflare in 2026: verify_cf, Docker and Startup Fixes

NSLSolver TeamPublished Updated 12 min read

Zendriver usually stops working on Cloudflare for one of four reasons: Chrome never starts ("Failed to connect to browser", common in Docker), verify_cf() times out because no clickable checkbox appears, Cloudflare rejects the click because of headless mode or a datacenter IP, or an old zendriver does not match your auto-updated Chrome. Upgrade to 0.18.0, fix start-up, run headed (or headless with the new Screen option), and call verify_cf() only when a checkbox is shown. At scale, move just that step to a managed solver.

Zendriver (cdpdriver/zendriver, about 1,500 GitHub stars, AGPL-3.0, not archived) is the community fork of nodriver: the same async Chrome DevTools Protocol API, but with a DOM-based verify_cf(), frequent releases and an open issue tracker. This guide covers zendriver-specific errors and issues; for nodriver itself, see [nodriver not working](/blog/nodriver-not-working).

Quick answer: match your zendriver error to the fix

These are the exact messages and symptoms zendriver users report. Find yours, then read the matching section below for code.

Failed to connect to browser ... In that case you need to pass sandbox=False
Chrome did not expose its DevTools endpoint in time (about 2.5 s by default). Raise browser_connection_max_tries and browser_connection_timeout, read Chrome's stderr in INFO logs, pass sandbox=False. Pre-0.17.1 releases suggest no_sandbox=True, which is ignored.
Could not determine browser executable.
The browser path does not exist (failed auto-detection says "could not find a valid browser binary"). Install google-chrome-stable or pass browser_executable_path; browser="chrome", "brave" or "msedge" picks the family.
TimeoutError: Cloudflare checkbox not found or not visible within 15 seconds.
verify_cf() never saw a visible challenges.cloudflare.com iframe. Often there was nothing to click: check for cf_clearance first. If the page loops, Cloudflare flagged the browser before showing a checkbox (issue #233).
TimeoutError: Could not solve the checkbox in 15 seconds (timeout during clicks).
The checkbox was clicked, but the response input never got a value. Datacenter IPs and headless clicks get rejected (issue #181). Use a cleaner IP, run headed, raise timeout.
verify_cf() returns, but nothing is clicked
Bug reported on 0.16.0: the cf-turnstile-response input was only searched inside the shadow host (issue #270). Upgrade to 0.17.0 or newer, or pass challenge_selector for custom markup.
Passes headed, loops on "Just a moment..." with headless=True
Before 0.18.0 headless dropped client hints and the challenge iframe still saw HeadlessChrome. Upgrade to 0.18.0 with screen=Screen(1920, 1080) (Chrome 142+), or run headed.
KeyError: 'sameParty' from browser.cookies.get_all()
Chrome 146 no longer always sends the sameParty cookie field (issue #244). Upgrade to zendriver 0.15.3 or newer.
SyntaxError when importing on Python 3.14, or "No matching distribution found for zendriver"
Python version mismatch. zendriver needs Python 3.10+; 0.15.5 fixed the 3.14 import error (issue #252).

Error strings are quoted from zendriver's source (browser.py, config.py, cloudflare.py), its CHANGELOG and the linked GitHub issues, checked on 2026-12-01 against version 0.18.0.

How zendriver handles a Cloudflare challenge

Zendriver drives a real Chrome (or Brave or Edge) over the DevTools Protocol, without Selenium or WebDriver. The challenge runs as in any browser; whether Cloudflare issues cf_clearance depends on how it scores that browser, its IP and its behaviour. As a maintainer put it in issue #127, zendriver is "a library to manipulate a browser through cdp, not a captcha solver".

Its Cloudflare helper, tab.verify_cf(click_delay=5, timeout=15, challenge_selector=None, flash_corners=False), reads the DOM instead of nodriver's OpenCV screenshots: it finds the challenges.cloudflare.com iframe inside a shadow root, waits until it is visible, then clicks near its left edge every click_delay seconds until the cf-turnstile-response input gets a value or disappears. If no response input exists, it returns quietly without clicking.

Why zendriver stops passing Cloudflare

  • Detection before the checkbox. In open issue #233, users report verify_cf() timing out because the element is never found; one commenter traced it to Cloudflare flagging the browser environment before any checkbox is rendered. No clicking code can fix that.
  • Clicks rejected by IP or mode. Issue #181 (labelled bot-detection) reports verify_cf() passing on a residential IP, while on a datacenter IP the page reloads with a fresh challenge; another user saw the same in headless mode.
  • Headless tells. Until 0.18.0, stripping HeadlessChrome from the user agent also dropped the Sec-CH-UA client hints, and cross-site iframes (the challenge) still saw HeadlessChrome. Chrome's 800x600 headless screen stays a tell unless you set screen.
  • Chrome drift. Chrome 146 broke cookie parsing (fixed in 0.15.3), Chrome 137+ ignored add_extension() (fixed in 0.17.0), and issue #142 reports start-up failures right after a Chrome 138 update on Windows. An old pinned zendriver next to an auto-updating Chrome explains many sudden breakages.

Fix 1: "Failed to connect to browser"

Zendriver polls Chrome's /json/version endpoint up to browser_connection_max_tries times (default 10), every browser_connection_timeout seconds (default 0.25). In slow containers about 2.5 seconds is not enough; a maintainer's first answer in issue #127 was to raise the retries. Chrome's stderr is logged at INFO level and usually names the real cause.

Root is only one cause, and zendriver already disables the sandbox for root on Linux. Issues add three more: running as administrator on Windows (#142, #247), Python under Rosetta on Apple Silicon (one user in #104 fixed it with a native arm64 Python), and failures right after a Chrome update (#142, still open).

start_zendriver.py
import asyncio
import logging

import zendriver as zd

# INFO level prints "Browser stderr: ..." when Chrome fails to start
logging.basicConfig(level=logging.INFO)


async def main():
    browser = await zd.start(
        headless=False,                   # headed; on a server run it under Xvfb
        sandbox=False,                    # adds --no-sandbox ("no_sandbox=True" is ignored)
        browser_executable_path="/usr/bin/google-chrome-stable",  # skip auto-detection
        browser_connection_timeout=1.0,   # seconds between attempts (default 0.25)
        browser_connection_max_tries=30,  # attempts (default 10); slow containers need more
    )
    tab = await browser.get("https://example.com/")
    print(await tab.evaluate("navigator.userAgent"))
    await browser.stop()  # a coroutine in zendriver


if __name__ == "__main__":
    asyncio.run(main())

Fix 2: running zendriver in Docker

The official answer is cdpdriver/zendriver-docker, a Linux-only template (AGPL-3.0) running a GPU-accelerated, headed Chrome under Sway (Wayland), with VNC on localhost:5910. Set RENDER_GROUP_GID in docker-compose.yml to the group owning your /dev/dri/renderD* node, then run docker compose up --build app (with the AMD or NVIDIA override file if needed).

For a lighter image, install google-chrome-stable and run headed under Xvfb, as below. Serverless is harder: AWS Lambda (#188) and Cloud Run (#127) reports start with "Failed to connect to browser". Lambda users suggested --disable-gpu and a /tmp --user-data-dir, unconfirmed; on Cloud Run, more retries got Chrome running, but the page stayed stuck on Cloudflare.

Dockerfile
FROM python:3.12-slim

# Google Chrome + Xvfb so Chrome can run headed on a virtual display
RUN apt-get update && apt-get install -y --no-install-recommends wget xvfb xauth \
 && wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
 && apt-get install -y ./google-chrome-stable_current_amd64.deb \
 && rm google-chrome-stable_current_amd64.deb && rm -rf /var/lib/apt/lists/*

RUN pip install --no-cache-dir "zendriver>=0.18.0"

WORKDIR /app
COPY app.py .
# zendriver already passes --disable-dev-shm-usage to Chrome
CMD ["xvfb-run", "-a", "python", "app.py"]

Fix 3: verify_cf() TimeoutError and when to call it

verify_cf() raises TimeoutError with one of two messages. "Cloudflare checkbox not found or not visible within N seconds" means no visible challenge iframe appeared: the challenge was non-interactive and passed (or failed) without a checkbox. "Could not solve the checkbox in N seconds (timeout during clicks)" means it clicked but the response input never filled: a rejected click.

So check first, click second: wait a few seconds, look for cf_clearance, and only then call verify_cf() with a timeout that covers click_delay plus Cloudflare's verification. challenge_selector targets a custom response input, flash_corners=True shows where it clicks, and zendriver.core.cloudflare.cf_is_interactive_challenge_present(tab, timeout) detects the checkbox without clicking.

zendriver_verify_cf.py
import asyncio

import zendriver as zd

TARGET = "https://example.com/"


async def has_clearance(browser):
    cookies = await browser.cookies.get_all()
    return any(c.name == "cf_clearance" for c in cookies)


async def main():
    browser = await zd.start(headless=False, sandbox=False)
    tab = await browser.get(TARGET)
    await tab.sleep(5)  # a non-interactive challenge often clears on its own

    if not await has_clearance(browser):
        try:
            # timeout covers finding AND clicking; click_delay is the pause between clicks
            await tab.verify_cf(timeout=30, click_delay=6)
        except TimeoutError as exc:
            # "Cloudflare checkbox not found or not visible within 30 seconds."
            # "Could not solve the checkbox in 30 seconds (timeout during clicks)."
            print("verify_cf:", exc)

    for _ in range(15):
        if await has_clearance(browser):
            print("cleared:", await tab.evaluate("document.title"))
            break
        await tab.sleep(1)
    await browser.stop()


if __name__ == "__main__":
    asyncio.run(main())

Fix 4: headless mode after the 0.18.0 changes

If you pass headed but not with headless=True, upgrade first. Version 0.18.0 (2026-11-21) keeps the Sec-CH-UA* headers and navigator.userAgentData when stripping HeadlessChrome, gives cross-site iframes the patched user agent from their first script, and adds screen=Screen(width, height, ...), applied through Chrome's --screen-info switch. Chrome older than 142 ignores it, and headed mode does not need it.

Headless remains the riskier mode: issue #181 reports clicks rejected in headless, and the project's own Docker template runs headed. Also, when attaching to a remote headless Chrome on another operating system, zendriver warns that its user agent override will drop the client hints.

zendriver_headless.py
import asyncio

import zendriver as zd
from zendriver import Screen  # zendriver >= 0.18.0


async def main():
    browser = await zd.start(
        headless=True,
        sandbox=False,
        # replaces Chrome's 800x600 headless screen; Chrome < 142 ignores it
        screen=Screen(1920, 1080, work_area_insets=(0, 0, 40, 0)),
    )
    tab = await browser.get("https://example.com/")
    print(await tab.evaluate("screen.width + 'x' + screen.height"))
    print(await tab.evaluate("navigator.userAgent"))  # no "HeadlessChrome"
    await browser.stop()


if __name__ == "__main__":
    asyncio.run(main())

Fix 5: exporting cf_clearance and reusing it

browser.cookies.get_all() returns CDP cookies; get_all(requests_cookie_format=True) returns http.cookiejar cookies (since 0.17.0 without needing requests installed, and with session cookies no longer marked expired). browser.cookies.save(file, pattern) and load(file, pattern) persist cookies matching a regex such as "cf_clearance". The file is a pickle, so only load files your own code wrote.

The cookie only works where it was earned: same navigator.userAgent, same exit IP, and note that Python HTTP clients have a different TLS fingerprint from Chrome. For authenticated proxies, Browser.create_context(url, proxy_server="http://user:pass@host:port") (0.17.0+) runs a local forwarder for HTTP, HTTPS and SOCKS5. Our cf_clearance cookie guide explains the binding.

zendriver_cookies.py
import asyncio

import requests
import zendriver as zd
from zendriver import cdp

TARGET = "https://example.com/"
PROXY = "http://user:pass@sticky-proxy.example.com:8080"  # same exit IP for browser AND replay


async def main():
    browser = await zd.start(headless=False, sandbox=False)
    # zendriver >= 0.17.0: per-context proxy, credentials handled by a local forwarder
    tab = await browser.create_context(TARGET, proxy_server=PROXY)
    await tab.sleep(10)  # or the verify_cf() flow above

    ua = await tab.evaluate("navigator.userAgent")
    cookies = await tab.send(cdp.network.get_cookies([TARGET]))  # cookies of THIS tab
    await browser.stop()

    session = requests.Session()
    session.proxies = {"http": PROXY, "https": PROXY}
    session.headers["User-Agent"] = ua  # exactly the UA that earned the cookie
    for c in cookies:
        session.cookies.set(c.name, c.value, domain=c.domain, path=c.path)
    print(session.get(TARGET, timeout=30).status_code)


if __name__ == "__main__":
    asyncio.run(main())

Migrating from nodriver to zendriver

Most nodriver scripts port in minutes, but a few differences break code. For nodriver-side errors (cf_verify versus verify_cf, OpenCV matching), see nodriver not working.

  • Install and Python: pip uninstall nodriver, then pip install "zendriver>=0.18.0". Zendriver needs Python 3.10 or newer.
  • Imports and loop: import zendriver as zd; zd.start() takes the same core options (headless, sandbox, browser_executable_path, user_data_dir, browser_args, lang). zendriver.loop() is deprecated since 0.5.1; use asyncio.run(main()).
  • Shutdown: browser.stop() is a coroutine in zendriver, so write await browser.stop().
  • verify_cf(): nodriver's template_image and flash arguments do not exist; use timeout, click_delay, challenge_selector and flash_corners, and catch TimeoutError instead of TypeError. OpenCV is no longer needed.
  • Element attributes: attribute access such as element.href is deprecated since 0.13.1; use element.get("href").
  • Iframes: since 0.17.0, find() and select() accept include_frames=True, and tab.get_frames() returns cross-origin iframes as Tab objects.

When to switch to an API

Keep zendriver when you need a real browser session. Move the challenge step to an API when loops persist after these fixes, when Chrome updates keep breaking deploys, or when you run GPUs and residential proxies just to collect one cookie per site. To compare other open-source tools first, see our comparison of open-source Turnstile and Cloudflare solvers or the Patchright troubleshooting guide.

Whatever you use, only automate sites you own or are explicitly authorised to access, and respect their terms and rate limits.

NSLSolver example: cf_clearance without running Chrome

NSLSolver solves the challenge server-side, with no browser on your side or ours. A POST to /solve with type challenge, the page url, the challenge site_key (the 0x... widget id) and your proxy returns cookies, including cf_clearance, plus the user_agent to replay through the same proxy. Leave user_agent out: the clearance is issued for the solver's iPhone Safari browser. The Cloudflare Challenge solver API averages about 3.3 s at $1.00 per 1,000, failed solves are free, and pricing starts with free credit with Google, Gmail or Proton sign-up.

For a Turnstile widget on a form, use type turnstile with site_key and url (about 250 ms, $0.80 per 1,000) and submit the token as cf-turnstile-response. NSLSolver does not solve reCAPTCHA v2, hCaptcha, image CAPTCHAs or DataDome.

nslsolver_challenge.py
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 Chrome, Xvfb and verify_cf()
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"))

Full /solve API reference

Related guides

Frequently asked questions

Why is zendriver not bypassing Cloudflare?

The challenge runs in its real Chrome, but Cloudflare still scores headless mode, IP and behaviour. Most failures are an outdated release, pre-0.18.0 headless, datacenter IPs (issue #181), or detection before any checkbox appears (issue #233).

How do I fix "Failed to connect to browser" in zendriver?

Pass sandbox=False, raise browser_connection_max_tries and browser_connection_timeout, read Chrome's stderr in INFO logs, check browser_executable_path, and on Windows run without administrator rights.

What does verify_cf() TimeoutError mean?

"Cloudflare checkbox not found or not visible" means no challenge iframe appeared, often because there was nothing to click. "(timeout during clicks)" means it clicked but the click was not accepted. Check for cf_clearance before calling it.

Does zendriver work in headless mode with Cloudflare?

Sometimes. Version 0.18.0 fixed missing client hints and HeadlessChrome leaking into challenge iframes, and added screen=Screen(1920, 1080) for Chrome 142+. Headless is still riskier than headed, so verify it per site or run headed under Xvfb.

How do I run zendriver in Docker?

Use the official zendriver-docker template (Linux, GPU, headed Chrome with VNC on port 5910), or a slim image with google-chrome-stable and xvfb-run, plus more connection retries. Lambda remains unreliable (issue #188).

Can NSLSolver replace zendriver for Cloudflare?

For the challenge step, yes: one POST to /solve with type challenge, url, site_key and proxy returns cf_clearance and the user_agent to replay through the same proxy, in about 3.3 s for $1.00 per 1,000 successful solves. Keep zendriver when you need a full browser session.

Get cf_clearance without running Chrome

One HTTP call returns the Cloudflare clearance cookie and matching User-Agent. Free credit with Google, Gmail or Proton sign-up, no card, and you only pay for successful solves.