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
// Copyright (C) 2023 Michael Lee <imichael2e2@proton.me/...@gmail.com>
//
// Licensed under the MIT License <LICENSE-MIT or
// https://opensource.org/license/mit> or the GNU General Public License,
// Version 3.0 or any later version <LICENSE-GPL or
// https://www.gnu.org/licenses/gpl-3.0.txt>, at your option.
//
// This file may not be copied, modified, or distributed except except in
// compliance with either of the licenses.
//
// #![feature(doc_auto_cfg)]
//!
//! A **W**eb**D**river **C**lient library.
//!
//! # Overview
//!
//! WebDriver is a widely-adopted W3C standard for web browser automation. It
//! defines algorithms in a platform-, language-independent manner. It
//! opens the possibility of using system programming languages such as Rust
//! or C/C++ for WebUI testing/browser automation, which leads to better
//! performance, efficiency, and safety.
//!
//! This crate provides a pure Rust implementation of
//! the client-side WebDriver, with the following goals:
//!
//! 1. **Standard Compliance**: it tracks both classical WebDriver and modern
//! BiDi standards.
//!
//! 2. **Low Overhead**: it has no runtime dependencies.
//!
//! 3. **Excellent Performance**: it strives for zero-copy operations.
//!
//! # Examples:
//! _Note: Assume using GeckoDriver, with default settings._
//!
//!
//! ## Navigate to website:
//!
//! ```ignore
//! use wdc::{GeckoDriver, WdcError, WebDrvClient};
//!
//! go_w3c().unwrap();
//!
//! fn go_w3c() -> Result<(), WdcError> {
//! let wdc: WebDrvClient<GeckoDriver> = wdc::init("127.0.0.1", 4444, 10)?;
//! let url = "https://www.w3.org/standards";
//!
//! wdc.navi_to(url)?;
//! // ...whatever tests/automation on "w3.org"
//!
//! Ok(())
//! }
//! ```
//!
//! ## Run Javascript on website:
//!
//! ```ignore
//! use wdc::{GeckoDriver, WdcError, WebDrvClient};
//!
//! check_out_w3c_history().unwrap();
//!
//! fn check_out_w3c_history() -> Result<(), WdcError> {
//! let wdc: WebDrvClient<GeckoDriver> = wdc::init("127.0.0.1", 4444, 10)?;
//! let url = "https://www.w3.org/Consortium/facts.html";
//!
//! let js_result = wdc.navi_to(url)?.exec_sync(
//! "return document.getElementById('history').nextElementSibling.innerText;",
//! vec![],
//! )?;
//!
//! let w3c_history = String::from_utf8_lossy(&js_result);
//! assert!(w3c_history.contains("Tim Berners-Lee"));
//! assert!(w3c_history.contains("World Wide Web"));
//! assert!(w3c_history.contains("HTML"));
//!
//! Ok(())
//! }
//! ```
// STRUCT //
// WdcError //
///
/// The WebDriver client-specific errors.
// Generic //
pub use init;
pub use init_singl;
pub use CreateW3cSession;
pub use CreateWebDrvClient;
pub use RendVendor;
pub use SessionMeta;
pub use WebDrvClient;
pub use init_singl_ff;
pub use GeckoDriver;
pub use init_singl_ch;
pub use ChromeDriver;