Skip to main content

Crate cdp_driver

Crate cdp_driver 

Source
Expand description

Chrome DevTools Protocol (CDP) client for browser automation.

Connects to a Chrome instance started with --remote-debugging-port and drives it over the CDP WebSocket: navigation, DOM/JS evaluation, screenshots, network interception, cookies, and more.

Two API layers are available:

Enable the blocking feature for a synchronous API ([blocking]) that needs no async runtime from the caller.

§Example

use cdp_driver::{BrowserAgent, BrowserAction, Config};

let agent = BrowserAgent::connect_with_config(&Config::default()).await?;

agent.execute(BrowserAction::Navigate {
    url: "https://example.com".to_string(),
}).await;

Re-exports§

pub use agent::ActionBuilder;
pub use agent::ActionResult;
pub use agent::BrowserAction;
pub use agent::BrowserAgent;
pub use client::CdpClient;
pub use config::Config;
pub use error::CdpError;
pub use error::Result;
pub use types::*;

Modules§

agent
High-level, serializable browser actions built on top of crate::client::CdpClient, suited to driving the browser from tool calls (LLM agents) or a fluent builder.
client
Low-level CDP client: one method per DevTools Protocol command.
cluster
A worker pool of pre-created tabs, distributing tasks with retries (puppeteer-cluster style). See Cluster.
config
Connection and viewport settings for BrowserAgent::connect_with_config.
error
The crate’s error type and Result alias.
network
Network and Fetch domain commands (cookies, headers, request interception), added to CdpClient here.
page
Page, Emulation, and DOM mutation commands, added to CdpClient here.
types
Plain data types returned by CDP commands and events.