cdp_driver/lib.rs
1//! Chrome DevTools Protocol (CDP) client for browser automation.
2//!
3//! Connects to a Chrome instance started with `--remote-debugging-port` and drives it
4//! over the CDP WebSocket: navigation, DOM/JS evaluation, screenshots, network
5//! interception, cookies, and more.
6//!
7//! Two API layers are available:
8//! - [`CdpClient`]: low-level, one method per CDP command.
9//! - [`BrowserAgent`] + [`BrowserAction`]: higher-level actions suited to driving
10//! the browser from an LLM tool call (see [`BrowserAgent::execute_json`]).
11//!
12//! Enable the `blocking` feature for a synchronous API ([`blocking`]) that needs no
13//! async runtime from the caller.
14//!
15//! # Example
16//!
17//! ```no_run
18//! use cdp_driver::{BrowserAgent, BrowserAction, Config};
19//!
20//! # async fn run() -> cdp_driver::Result<()> {
21//! let agent = BrowserAgent::connect_with_config(&Config::default()).await?;
22//!
23//! agent.execute(BrowserAction::Navigate {
24//! url: "https://example.com".to_string(),
25//! }).await;
26//! # Ok(())
27//! # }
28//! ```
29
30pub mod agent;
31pub mod client;
32pub mod cluster;
33pub mod config;
34pub mod error;
35pub mod network;
36pub mod page;
37pub mod types;
38
39#[cfg(feature = "blocking")]
40pub mod blocking;
41
42pub use agent::{ActionBuilder, ActionResult, BrowserAction, BrowserAgent};
43pub use client::CdpClient;
44pub use config::Config;
45pub use error::{CdpError, Result};
46pub use types::*;