Skip to main content

rustenium/
lib.rs

1//! # Rustenium
2//!
3//! A modern, high-performance WebDriver BiDi automation library for Rust.
4//!
5//! ## Features
6//!
7//! - **WebDriver BiDi Protocol**: Native support for the next-generation WebDriver BiDi protocol
8//! - **Chrome/Chromium Support**: Full Chrome and Chromium browser automation
9//! - **High-Level API**: Intuitive, ergonomic API for browser automation tasks
10//! - **Human-like Input**: Built-in support for realistic mouse movements and interactions
11//! - **Touch Support**: Multi-touch gestures and touchscreen simulation
12//! - **Network Interception**: Intercept and modify network requests
13//! - **Screenshot Capture**: Element and viewport screenshot capabilities
14//! - **Event Handling**: Subscribe to browser and page events
15//! - **Type-Safe**: Strongly-typed API leveraging Rust's type system
16//!
17//! ## Quick Start
18//!
19//! ```no_run
20//! use rustenium::browsers::{ChromeBrowser, ChromeConfig, chrome};
21//! use rustenium::css;
22//!
23//! #[tokio::main]
24//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
25//!     // Option 1: Using ChromeBrowser::new
26//!     let config = ChromeConfig {
27//!         driver_executable_path: "chromedriver".to_string(),
28//!         ..Default::default()
29//!     };
30//!     let mut browser = ChromeBrowser::new(config).await;
31//!
32//!     // Option 2: Using chrome helper
33//!     let mut browser = chrome(None).await; // Uses default config
34//!
35//!     // Navigate to a page
36//!     browser.open_url("https://example.com", None, None).await?;
37//!
38//!     // Find elements using CSS selectors
39//!     let nodes = browser.find_nodes(css!("h1"), None, None, None, None).await?;
40//!
41//!     // Get text content
42//!     if let Some(node) = nodes.first() {
43//!         let text = node.get_inner_text().await;
44//!         println!("Heading: {}", text);
45//!     }
46//!
47//!     // Clean up
48//!     browser.end_bidi_session().await?;
49//!
50//!     Ok(())
51//! }
52//! ```
53//!
54//! ## Main Components
55//!
56//! - [`browsers::ChromeBrowser`] - Main browser automation interface
57//! - [`browsers::ChromeConfig`] - Browser configuration
58//! - [`browsers::ChromeCapabilities`] - Browser capabilities builder
59//! - [`browsers::chrome()`] - Convenience function to create a browser
60//! - [`nodes::ChromeNode`] - DOM element representation for Chrome
61//! - [`input::BidiMouse`] - Direct, instant mouse movements for fast automation
62//! - [`input::HumanMouse`] - Realistic mouse movements with Bezier curves and jitter
63//! - [`input::BidiKeyboard`] - Keyboard input for typing text and pressing keys
64//! - [`input::Touchscreen`] - Multi-touch gesture support for mobile testing
65//!
66//! ## Macros
67//!
68//! Enable the `macros` feature for convenient selector macros:
69//!
70//! ```toml
71//! [dependencies]
72//! rustenium = { version = "1.0.0", features = ["macros"] }
73//! ```
74//!
75//! Then use `css!()` and `xpath!()` macros for element selection.
76
77mod conduit;
78pub mod domain;
79pub mod downloader;
80pub mod error;
81pub mod browsers;
82pub mod nodes;
83pub mod input;
84
85
86#[cfg(feature = "macros")]
87pub use rustenium_macros::*;
88
89pub use conduit::*;