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 action::BrowserAction;pub use action_builder::ActionBuilder;pub use agent::ActionResult;pub use agent::BrowserAgent;pub use client::CdpClient;pub use config::Config;pub use error::CdpError;pub use error::Result;pub use types::*;
Modules§
- action
- The vocabulary of browser operations.
- action_
builder - Assembling a sequence of
BrowserActions to run in one go. - action_
parse - Reading a
BrowserActionout of the flat JSON an LLM tool call sends. - agent
- Running
BrowserActions against a tab and reporting how each one went. - 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. - keys
- Keyboard names as
Input.dispatchKeyEventwants them. - methods
- CDP method names, one module per protocol domain.
- 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.