[−][src]Crate selenium_rs
This library provides a client API for the selenium webdriver specification:
#Usage
[dependencies]
selenium-rs = "0.1"
and add this to your root crate:
extern crate selenium_rs;
Requirements
Selenium-rs requires that there is an instance of the selenium-webdriver server running to make requests against.
As of right now the easiest way to get this is to download the standalone from: [https://www.seleniumhq.org/download/], and then running it (requires Java 1.8+)
Example: Make a google search, programmatically
use selenium_rs::webdriver::{Browser, WebDriver, Selector}; let mut driver = WebDriver::new(Browser::Chrome); driver.start_session(); driver.navigate("http://google.com"); let search_bar = driver.find_element(Selector::CSS, "input[maxlength=\"2048\"]").unwrap(); search_bar.type_text("selenium-rs github"); let search_button = driver.find_element(Selector::CSS, "input[name=\"btnK\"]").unwrap(); search_button.click();
Modules
element | Element enables most of the site interaction, and wraps user interactions such as typing text and clicking on things. Note that each element is tied to the specific session (currently, we can't hold on to the same element across sessions). |
webdriver | This provides the primary point of interaction with the Selenium WebDriver API. We can use it to create and manage sessions, as well as use it to spawn elements from the current browsing context. |