cdp-rs
A robust Rust library for controlling Chrome/Chromium browsers via the Chrome DevTools Protocol (CDP).
Features
- 🌐 Browser Control - Launch, connect, and manage browser instances
- 🔍 Element Interaction - Find, click, type, and manipulate DOM elements. Features seamless Cross-iframe querying and Shadow Root (open/closed) support
- 📸 Screenshots - Capture element and full-page screenshots
- 🌐 Network Control - Intercept, monitor, and modify network requests
- ⌨️ Input Simulation - Realistic keyboard and mouse input
- 💾 Storage Management - Control cookies, localStorage, and sessionStorage
- ⏳ Smart Waiting - Wait for selectors, navigation, network idle, custom conditions
- 🎭 Emulation - Device emulation, geolocation, user agents
- ♿ Accessibility - Inspect accessibility tree
- 📊 Performance Tracing - Capture performance traces
Quick Start
use ;
use Arc;
async
Installation
Add to your Cargo.toml:
[]
= "0.1.0"
= { = "1", = ["full"] }
Documentation
- Getting Started Guide - Installation and first steps
- API Reference - Quick reference for all APIs
- Feature Guides - Detailed documentation for each feature
- How-To Guides - Practical recipes and patterns
Examples
Check out the examples directory for runnable code:
# Run basic example
# Run comprehensive test
# Run web scraping example
Architecture
cdp-core provides a high-level, async Rust API over the Chrome DevTools Protocol:
┌─────────────────────────────────────┐
│ Your Application │
└─────────────────┬───────────────────┘
│
┌─────────────────▼───────────────────┐
│ cdp-core API │
│ (Browser, Page, Element, Network) │
└─────────────────┬───────────────────┘
│
┌─────────────────▼───────────────────┐
│ Chrome DevTools Protocol (CDP) │
└─────────────────┬───────────────────┘
│
┌─────────────────▼───────────────────┐
│ Chrome/Chromium Browser │
└─────────────────────────────────────┘
Requirements
- Chrome or Chromium browser
- Rust 1.70 or later
- Tokio async runtime
License
This project is licensed under the MIT license.
Contributing
Contributions welcome! Please see CONTRIBUTING.md for details.