Skip to main content

Crate zendriver

Crate zendriver 

Source
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

§Feature flags

FlagCratePurpose
expectin-treeexpect_request / expect_response / expect_dialog / expect_download
interceptionzendriver-interceptionFetch.*-backed request rewriting / abort
cloudflarezendriver-cloudflareCloudflare Turnstile bypass
fetcherzendriver-fetcherChrome-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;expect
pub use expect::request::MatchedRequest;expect
pub use expect::request::RequestExpectation;expect
pub use expect::response::MatchedResponse;expect
pub use expect::response::ResponseExpectation;expect
pub use expect::dialog::DialogExpectation;expect
pub use expect::dialog::DialogType;expect
pub use expect::dialog::MatchedDialog;expect
pub use expect::download::DownloadExpectation;expect
pub use expect::download::DownloadProgressState;expect
pub use expect::download::DownloadState;expect
pub 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 zendriver crate.
expectexpect
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 shared AriaRole / BoundingBox types.
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§

CloudflareBypasscloudflare
Cloudflare Turnstile bypass re-exports.
Connection
Cheap-to-clone handle to the connection actor. All Tabs and Elements hold one of these (via Arc<...>); the actor itself runs in a separate tokio task.
Fetcherfetcher
Chrome-for-Testing fetcher re-exports.
FetcherProgressfetcher
Chrome-for-Testing fetcher re-exports.
InterceptBuilderinterception
Network interception API re-exports.
InterceptHandleinterception
Network interception API re-exports.
PausedRequestinterception
Network interception API re-exports.
RequestInfointerception
Network interception API re-exports.
RequestOverridesinterception
Network interception API re-exports.
ResponseInfointerception
Network interception API re-exports.
SessionHandle
Cheap-to-clone handle binding a Connection to a specific CDP session.

Enums§

AbortReasoninterception
Network interception API re-exports.
CallError
Result of a CDP call: either a transport-level failure, or a structured JSON-RPC error returned by Chrome. Higher layers (the zendriver crate) map Rpc into the typed ZendriverError::Cdp variant.
Channelfetcher
Chrome-for-Testing fetcher re-exports.
ClearanceOutcomecloudflare
Cloudflare Turnstile bypass re-exports.
CloudflareErrorcloudflare
Cloudflare Turnstile bypass re-exports.
FetcherErrorfetcher
Chrome-for-Testing fetcher re-exports.
FetcherPhasefetcher
Chrome-for-Testing fetcher re-exports.
InterceptionErrorinterception
Network interception API re-exports.
Platformfetcher
Chrome-for-Testing fetcher re-exports.
RequestStageinterception
Network interception API re-exports.
ResourceTypeinterception
Network interception API re-exports.
TransportError
Connection-level failure modes — anything that happens “below” a CDP response getting routed back to its caller.
VersionSpecfetcher
Chrome-for-Testing fetcher re-exports.

Functions§

start
Convenience entry point: launch a Chrome instance with default settings.