Expand description
Async, undetectable Chrome automation over the Chrome DevTools Protocol.
zendriver is the high-level browser-automation entry point built on a
CDP-over-WebSocket transport. The crate aims to feel like Playwright /
Puppeteer for Rust while staying explicit about its CDP underpinnings —
every public type maps cleanly to a CDP surface, every action has a
single-call escape hatch, and stealth is on by default.
See the user guide / mdBook for end-to-end walkthroughs covering installation, quickstart, stealth, multi-tab, frames, input, and migration guides from Playwright / zendriver (Python) / nodriver (Python).
§Quickstart
let browser = zendriver::Browser::builder().launch().await?;
let tab = browser.main_tab();
tab.goto("https://example.com").await?;
let title: String = tab.evaluate_main("document.title").await?;
println!("{title}");
browser.close().await?;§Module layout
browser— process lifecycle (Browser,BrowserBuilder).tab— per-page handle (Tab); the main interaction surface.frame— same-process + out-of-process iframes (Frame).element— DOM handle (Element) returned byqueryhelpers.query— query builders, ARIA roles, actionability checks.cookies/storage— browser-scope cookie jar + per-tab storage.screenshot— screenshot builder (PNG / JPEG / WebP / full-page).input— keyboard / mouse / modifier state.error—ZendriverError+Resultalias.traits—Queryable/Evaluablefor code generic over Tab + Frame + Element.expect(featureexpect) — Playwright-styleexpect_*helpers.
§Feature flags
| Flag | Crate | Purpose |
|---|---|---|
expect | in-tree | expect_request / expect_response / expect_dialog / expect_download |
monitor | in-tree | tab.monitor() persistent Stream<NetworkEvent> (HTTP / WebSocket / EventSource) |
interception | zendriver-interception | Fetch.*-backed request rewriting / abort |
cloudflare | zendriver-cloudflare | Cloudflare Turnstile bypass |
imperva | zendriver-imperva | Imperva WAF / Incapsula bypass |
fetcher | zendriver-fetcher | Chrome-for-Testing download cache |
Each gated module is re-exported here under #[cfg(feature = "...")] so
downstream code can use zendriver::AbortReason etc. without depending on
the sub-crate directly.
Re-exports§
pub use browser::Browser;pub use browser::BrowserBuilder;pub use browser::Channel;pub use browser::PermissionType;pub use browser_context::BrowserContext;pub use cookies::Cookie;pub use cookies::CookieJar;pub use cookies::CookiePriority;pub use cookies::CookieSourceScheme;pub use cookies::SameSite;pub use element::Element;pub use element::actions::ClickOptions;pub use error::BrowserError;pub use error::Result;pub use error::ZendriverError;pub use frame::Frame;pub use input::Key;pub use input::KeyModifiers;pub use input::KeySequence;pub use input::MouseButton;pub use input::SpecialKey;pub use pdf::PdfBuilder;pub use query::AriaRole;pub use query::BoundingBox;pub use query::FindBuilder;pub use query::PageBox;pub use request::RequestBuilder;pub use request::Response;pub use screenshot::Format;pub use screenshot::ScreenshotBuilder;pub use storage::Storage;pub use tab::FrameResourceMatch;pub use tab::IdleOptions;pub use tab::ReadyState;pub use tab::ReloadOptions;pub use tab::ScrollOptions;pub use tab::Tab;pub use tab::UserAgentOverride;pub use traits::Evaluable;pub use traits::Queryable;pub use window::WindowBounds;pub use window::WindowState;pub use monitor::FrameDirection;monitorpub use monitor::MonitorBuilder;monitorpub use monitor::MonitoredRequest;monitorpub use monitor::MonitoredResponse;monitorpub use monitor::NetworkEvent;monitorpub use monitor::NetworkExchange;monitorpub use monitor::NetworkMonitor;monitorpub use expect::request::MatchedRequest;expectpub use expect::request::RequestExpectation;expectpub use expect::response::MatchedResponse;expectpub use expect::response::ResponseExpectation;expectpub use expect::dialog::DialogExpectation;expectpub use expect::dialog::DialogType;expectpub use expect::dialog::MatchedDialog;expectpub use expect::download::DownloadExpectation;expectpub use expect::download::DownloadProgressState;expectpub use expect::download::DownloadState;expectpub use expect::download::MatchedDownload;expect
Modules§
- browser
- Browser lifecycle: executable discovery, subprocess spawn, WS attach, graceful teardown.
- browser_
context - Per-
BrowserContextlifecycle on top of CDPTarget.createBrowserContext. - cookies
- Browser-wide cookie store backed by CDP
Network.*Cookies*methods. - element
- Handle to a DOM node via CDP
RemoteObjectId/BackendNodeId. - error
- Error hierarchy for the
zendrivercrate. - expect
expect - Event expectation helpers (
expect_request/expect_response/expect_dialog/expect_download). - frame
- Handle to a single document frame within a
crate::Tab. - input
- Realistic + raw input simulation: mouse paths, keyboard dispatch, per-tab pointer/modifier state.
- monitor
monitor - Persistent network monitor: a
Stream<NetworkEvent>over HTTP exchanges, WebSocket frames, and EventSource messages. Passive (Network domain) — read-only; use theinterceptionfeature (Fetch domain) to modify requests. - network_
idle - Per-Tab in-flight network request tracker.
- Chainable PDF export + MHTML snapshot for a
Tab. - query
- Element query builders (
FindBuilder/FindAllBuilder) and the sharedAriaRole/BoundingBoxtypes. - request
- Browser-context HTTP:
tab.request()runsfetchin the page (cookies + CORS inherited) with an opt-inNetwork.loadNetworkResourcebypass. - screenshot
- Chainable screenshot capture for a
Tab. - stealth
- Stealth profile + fingerprint configuration re-exported from
zendriver-stealth. - storage
- Per-Tab DOM storage handle (localStorage / sessionStorage) backed by CDP
DOMStorage.*methods. - tab
- Per-page handle to a single CDP target session.
- traits
- Traits enabling generic code over Tab + Frame + Element.
- window
- OS-window bounds + state control for a
Tab.
Structs§
- Captcha
Challenge imperva - Imperva WAF / Incapsula bypass surface re-exports.
- Captcha
Solution imperva - Imperva WAF / Incapsula bypass surface re-exports.
- Cloudflare
Bypass cloudflare - Cloudflare Turnstile bypass re-exports.
- Connection
- Cheap-to-clone handle to the connection actor. All
Tabs andElements hold one of these (viaArc<...>); the actor itself runs in a separate tokio task. - Cookie
Snapshot imperva - Imperva WAF / Incapsula bypass surface re-exports.
- Data
Dome Bypass datadome - DataDome bypass surface re-exports. Gated by the
datadomecargo feature. Drives a DataDome clearance flow against a single tab’s session. - Data
Dome Challenge datadome - DataDome bypass surface re-exports. Gated by the
datadomecargo feature. CAPTCHA escalation handed to a caller-supplied solver. - Data
Dome Solution datadome - DataDome bypass surface re-exports. Gated by the
datadomecargo feature. Token returned by a caller-supplied solver. For DataDome this is the solveddatadomeCOOKIE value. - Detection
Snapshot imperva - Imperva WAF / Incapsula bypass surface re-exports.
- Fetcher
fetcher - Chrome-for-Testing fetcher re-exports.
- Fetcher
Progress fetcher - Chrome-for-Testing fetcher re-exports.
- Host
Matcher interception - Network interception API re-exports.
- Imperva
Bypass imperva - Imperva WAF / Incapsula bypass surface re-exports.
- Intercept
Builder interception - Network interception API re-exports.
- Intercept
Handle interception - Network interception API re-exports.
- Paused
Request interception - Network interception API re-exports.
- Persona
- Unified fingerprint configuration. Every field optional → overlay semantics.
- Persona
Builder - Fluent builder for
Persona. Every setter is optional. - Request
Info interception - Network interception API re-exports.
- Request
Overrides interception - Network interception API re-exports.
- Response
Info interception - Network interception API re-exports.
- Response
Overrides interception - Network interception API re-exports.
- Seed
- A fingerprint seed. Serializes transparently as its u64 value.
- Session
Handle - Cheap-to-clone handle binding a
Connectionto a specific CDP session.
Enums§
- Abort
Reason interception - Network interception API re-exports.
- Call
Error - Result of a CDP call: either a transport-level failure, or a structured
JSON-RPC error returned by Chrome. Higher layers (the
zendrivercrate) mapRpcinto the typedZendriverError::Cdpvariant. - Captcha
Kind imperva - Imperva WAF / Incapsula bypass surface re-exports.
- Clearance
Outcome cloudflare - Cloudflare Turnstile bypass re-exports.
- Cloudflare
Error cloudflare - Cloudflare Turnstile bypass re-exports.
- Data
Dome Clearance Outcome datadome - DataDome clearance outcome (aliased to avoid colliding with the cloudflare
and imperva
ClearanceOutcome). Terminal outcome of a clearance attempt. All flow-terminals areOk; only genuine faults areDataDomeError. - Data
Dome Error datadome - DataDome bypass surface re-exports. Gated by the
datadomecargo feature. Error returned byDataDomeBypassoperations. Faults only — flow terminals (cleared / blocked / timed-out / already-clear) areClearanceOutcomevariants, not errors. - Data
Dome Surface datadome - DataDome bypass surface re-exports. Gated by the
datadomecargo feature. Which DataDome surface a tab is currently showing. - Fetcher
Channel fetcher - Chrome-for-Testing fetcher re-exports.
- Fetcher
Error fetcher - Chrome-for-Testing fetcher re-exports.
- Fetcher
Phase fetcher - Chrome-for-Testing fetcher re-exports.
- Imperva
Clearance Outcome imperva - Imperva-bypass clearance outcome (aliased to avoid colliding with the
cloudflare crate’s
ClearanceOutcome). Outcome of a successfulwait_for_clearance. - Imperva
Error imperva - Imperva WAF / Incapsula bypass surface re-exports.
- Imperva
Surface imperva - Imperva WAF / Incapsula bypass surface re-exports.
- Interception
Error interception - Network interception API re-exports.
- Platform
fetcher - Chrome-for-Testing fetcher re-exports.
- Request
Stage interception - Network interception API re-exports.
- Resource
Type interception - Network interception API re-exports.
- Strategy
- How a resolved persona is applied to a surface in the page.
- Surface
- A fingerprint surface.
- Transport
Error - Connection-level failure modes — anything that happens “below” a CDP response getting routed back to its caller.
- UrlMatcher
- Re-export the shared
UrlMatcherused byexpect_*andmonitor. URL match predicate used by request/response expectations. - Version
Spec fetcher - Chrome-for-Testing fetcher re-exports.
Functions§
- datadome_
detect_ surface datadome - DataDome bypass surface re-exports. Gated by the
datadomecargo feature. Surface-only probe. Convenience for “which surface am I on” without driving a bypass. - detect_
surface imperva - Imperva WAF / Incapsula bypass surface re-exports.
- start
- Convenience entry point: launch a Chrome instance with default settings.