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
//! A high-level API to control headless Chrome or Chromium over the DevTools Protocol. It is the
//! Rust equivalent of [Puppeteer](https://github.com/GoogleChrome/puppeteer), a Node library
//! maintained by the Chrome DevTools team.
//!
//! It is not 100% feature compatible with Puppeteer, but there's enough here to satisfy most
//! browser testing / web crawling use cases, and there are several 'advanced' features such as:
//!
//! - [network request interception](https://docs.rs/headless_chrome/latest/headless_chrome/browser/tab/struct.Tab.html#method.enable_request_interception)
//! - [JavaScript coverage monitoring](https://docs.rs/headless_chrome/latest/headless_chrome/browser/tab/struct.Tab.html#method.take_precise_js_coverage)
//! - [taking screenshots of elements or the entire page](https://docs.rs/headless_chrome/latest/headless_chrome/browser/tab/struct.Tab.html#method.capture_screenshot)
//! - [saving pages to PDF](https://docs.rs/headless_chrome/latest/headless_chrome/browser/tab/struct.Tab.html#method.print_to_pdf)
//! - ['headful' browsing](https://docs.rs/headless_chrome/latest/headless_chrome/struct.LaunchOptionsBuilder.html#method.headless)
//! - automatic downloading of 'known good' Chromium binaries for Linux / Mac / Windows
//! - [extension pre-loading](https://docs.rs/headless_chrome/latest/headless_chrome/struct.LaunchOptionsBuilder.html#method.extensions)
//!
//! # Quick Start
//!
//! ```no_run
//!use std::error::Error;
//!use headless_chrome::Browser;
//!use headless_chrome::protocol::cdp::Page;
//!
//!fn browse_wikipedia() -> Result<(), Box<dyn Error>> {
//! let browser = Browser::default()?;
//!
//! let tab = browser.new_tab()?;
//!
//! // Navigate to wikipedia
//! tab.navigate_to("https://www.wikipedia.org")?;
//!
//! // Wait for network/javascript/dom to make the search-box available
//! // and click it.
//! tab.wait_for_element("input#searchInput")?.click()?;
//!
//! // Type in a query and press `Enter`
//! tab.type_str("WebKit")?.press_key("Enter")?;
//!
//! // We should end up on the WebKit-page once navigated
//! let elem = tab.wait_for_element("#firstHeading")?;
//! assert!(tab.get_url().ends_with("WebKit"));
//!
//! /// Take a screenshot of the entire browser window
//! let jpeg_data = tab.capture_screenshot(
//! Page::CaptureScreenshotFormatOption::Jpeg,
//! None,
//! None,
//! true)?;
//! // Save the screenshot to disc
//! std::fs::write("screenshot.jpeg", jpeg_data)?;
//!
//! /// Take a screenshot of just the WebKit-Infobox
//! let png_data = tab
//! .wait_for_element("#mw-content-text > div > table.infobox.vevent")?
//! .capture_screenshot(Page::CaptureScreenshotFormatOption::Png)?;
//! // Save the screenshot to disc
//! std::fs::write("screenshot.png", png_data)?;
//!
//! // Run JavaScript in the page
//! let remote_object = elem.call_js_fn(r#"
//! function getIdTwice () {
//! // `this` is always the element that you called `call_js_fn` on
//! const id = this.id;
//! return id + id;
//! }
//! "#, vec![], false)?;
//! match remote_object.value {
//! Some(returned_string) => {
//! dbg!(&returned_string);
//! assert_eq!(returned_string, "firstHeadingfirstHeading".to_string());
//! }
//! _ => unreachable!()
//! };
//!
//! Ok(())
//!}
//! ```
pub use ;
pub use FetcherOptions;
pub use Revision;
type _READMETEST = ;