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 |
interception | zendriver-interception | Fetch.*-backed request rewriting / abort |
cloudflare | zendriver-cloudflare | Cloudflare Turnstile 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 cookies::Cookie;pub use cookies::CookieJar;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::MouseButton;pub use input::SpecialKey;pub use query::AriaRole;pub use query::BoundingBox;pub use query::FindBuilder;pub use screenshot::Format;pub use screenshot::ScreenshotBuilder;pub use storage::Storage;pub use tab::Tab;pub use traits::Evaluable;pub use traits::Queryable;pub use expect::UrlMatcher;expectpub 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.
- 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.
- network_
idle - Per-Tab in-flight network request tracker.
- query
- Element query builders (
FindBuilder/FindAllBuilder) and the sharedAriaRole/BoundingBoxtypes. - 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.
Structs§
- 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. - Fetcher
fetcher - Chrome-for-Testing fetcher re-exports.
- Fetcher
Progress fetcher - Chrome-for-Testing fetcher 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.
- Request
Info interception - Network interception API re-exports.
- Request
Overrides interception - Network interception API re-exports.
- Response
Info interception - Network interception API re-exports.
- 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. - Channel
fetcher - Chrome-for-Testing fetcher re-exports.
- Clearance
Outcome cloudflare - Cloudflare Turnstile bypass re-exports.
- Cloudflare
Error cloudflare - Cloudflare Turnstile bypass re-exports.
- Fetcher
Error fetcher - Chrome-for-Testing fetcher re-exports.
- Fetcher
Phase fetcher - Chrome-for-Testing fetcher 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.
- Transport
Error - Connection-level failure modes — anything that happens “below” a CDP response getting routed back to its caller.
- Version
Spec fetcher - Chrome-for-Testing fetcher re-exports.
Functions§
- start
- Convenience entry point: launch a Chrome instance with default settings.