firefox_webdriver/browser/mod.rs
1//! Browser entities module.
2//!
3//! This module provides the core browser automation types:
4//!
5//! | Type | Description |
6//! |------|-------------|
7//! | [`Window`] | Browser window (owns Firefox process, references shared pool) |
8//! | [`Tab`] | Browser tab (frame context) |
9//! | [`Element`] | DOM element reference |
10//! | [`Key`] | Keyboard key constants |
11//! | [`By`] | Element locator strategies |
12//!
13//! # Example
14//!
15//! ```no_run
16//! use firefox_webdriver::{Driver, Result, Key, By};
17//!
18//! # async fn example() -> Result<()> {
19//! let driver = Driver::builder()
20//! .binary("/usr/bin/firefox")
21//! .extension("./extension")
22//! .build()
23//! .await?;
24//!
25//! let window = driver.window().headless().spawn().await?;
26//! let tab = window.tab();
27//!
28//! tab.goto("https://example.com").await?;
29//!
30//! // Find with By selector
31//! let element = tab.find_element(By::tag("h1")).await?;
32//!
33//! // Find by text
34//! let btn = tab.find_element(By::text("Submit")).await?;
35//!
36//! // Press keys
37//! element.press(Key::Enter).await?;
38//! # Ok(())
39//! # }
40//! ```
41
42// ============================================================================
43// Submodules
44// ============================================================================
45
46/// DOM element interaction.
47pub mod element;
48
49/// Keyboard key definitions.
50pub mod keyboard;
51
52/// Network interception types.
53pub mod network;
54
55/// Proxy configuration types.
56pub mod proxy;
57
58/// Element locator strategies.
59pub mod selector;
60
61/// Browser tab automation.
62pub mod tab;
63
64/// Browser window management.
65pub mod window;
66
67// ============================================================================
68// Re-exports
69// ============================================================================
70
71pub use element::Element;
72pub use keyboard::Key;
73pub use network::{
74 BodyAction, HeadersAction, InterceptedRequest, InterceptedRequestBody,
75 InterceptedRequestHeaders, InterceptedResponse, InterceptedResponseBody, RequestAction,
76 RequestBody, ResponseAction,
77};
78pub use proxy::{ProxyConfig, ProxyType};
79pub use selector::By;
80pub use tab::{FrameInfo, ImageFormat, ScreenshotBuilder, Tab};
81pub use window::{Window, WindowBuilder};
82
83// Re-export Cookie from protocol for convenience
84pub use crate::protocol::Cookie;