1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
//! Thirtyfour is a Selenium / WebDriver library for Rust, for automated website UI testing.
//!
//! It supports the full W3C WebDriver spec.
//! Tested with Chrome and Firefox although any W3C-compatible WebDriver
//! should work.
//!
//! This crate provides a synchronous (i.e. not async) interface for `thirtyfour`.
//! For async, see the [thirtyfour](https://docs.rs/thirtyfour) crate instead.
//!
//! ## Features
//!
//! - All W3C WebDriver and WebElement methods supported
//! - Create new browser session directly via WebDriver (e.g. chromedriver)
//! - Create new browser session via Selenium Standalone or Grid
//! - Automatically close browser session on drop
//! - Find elements (via all common selectors e.g. Id, Class, CSS, Tag, XPath)
//! - Send keys to elements, including key-combinations
//! - Execute Javascript
//! - Action Chains
//! - Get and set cookies
//! - Switch to frame/window/element/alert
//! - Shadow DOM support
//! - Alert support
//! - Capture / Save screenshot of browser or individual element as PNG
//! - Chrome DevTools Protocol support
//!
//! ## Cargo features
//! There are four `reqwest-*-tls*`-features, which enable the respective features in the `reqwest` dependency:
//! - **reqwest-default-tls** *(enabled by default)*: Provides TLS support to connect over HTTPS.
//! - **reqwest-native-tls**: Enables TLS functionality provided by `native-tls`.
//! - **reqwest-native-tls-vendored**: Enables the `vendored` feature of `native-tls`.
//! - **reqwest-rustls-tls**: Enables TLS functionality provided by `rustls`.
//!
//! ## Examples
//!
//! The following example assumes you have a selenium server running
//! at localhost:4444, and a demo web app running at http://webappdemo
//!
//! You can set these up using docker-compose, as follows:
//!
//! ```ignore
//! docker-compose up -d
//! ```
//!
//! The included web app demo is purely for demonstration / unit testing
//! purposes and is not required in order to use this library in other projects.
//!
//!
//! ### Example (synchronous):
//!
//! ```rust
//! use thirtyfour_sync::prelude::*;
//!
//! fn main() -> WebDriverResult<()> {
//! let caps = DesiredCapabilities::chrome();
//! let driver = WebDriver::new("http://localhost:4444/wd/hub", &caps)?;
//!
//! // Navigate to URL.
//! driver.get("http://webappdemo")?;
//!
//! // Navigate to page.
//! driver.find_element(By::Id("pagetextinput"))?.click()?;
//!
//! // Find element.
//! let elem_div = driver.find_element(By::Css("div[data-section='section-input']"))?;
//!
//! // Find element from element.
//! let elem_text = elem_div.find_element(By::Name("input1"))?;
//!
//! // Type in the search terms.
//! elem_text.send_keys("selenium")?;
//!
//! // Click the button.
//! let elem_button = elem_div.find_element(By::Tag("button"))?;
//! elem_button.click()?;
//!
//! // Get text value of element.
//! let elem_result = driver.find_element(By::Id("input-result"))?;
//! assert_eq!(elem_result.text()?, "selenium");
//!
//! // Close the browser.
//! driver.quit()?;
//!
//! Ok(())
//! }
//! ```
//!
//! ### Advanced element queries and explicit waits
//!
//! You can use `WebDriver::query()` and `WebElement::query()` to perform more advanced queries
//! including polling and filtering. Custom filter functions are also supported.
//!
//! Also the `WebElement::wait_until()` method provides additional support for explicit waits
//! using a variety of built-in predicates. You can also provide your own custom predicate if
//! desired.
//!
//! See the [query](query/index.html) module documentation for more details.
/// Re-export common types.
pub use ;
pub use error;
pub use SessionId;
pub use Alert;
pub use WebDriverSession;
pub use SwitchTo;
pub use GenericWebDriver;
pub use WebDriver;
pub use WebDriverCommands;
pub use WebElement;
/// Extensions for specific browsers.
/// Wrappers for specific component types.
// ElementQuery and ElementWaiter interfaces.