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 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 BrowserAction out 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 Result alias.
keys
Keyboard names as Input.dispatchKeyEvent wants them.
methods
CDP method names, one module per protocol domain.
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.