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:
CdpClient: low-level, one method per CDP command.BrowserAgent+BrowserAction: higher-level actions suited to driving the browser from an LLM tool call (seeBrowserAgent::execute_json).
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
Resultalias. - network
NetworkandFetchdomain commands (cookies, headers, request interception), added toCdpClienthere.- page
Page,Emulation, andDOMmutation commands, added toCdpClienthere.- types
- Plain data types returned by CDP commands and events.