Crates.io | thirtyfour |
lib.rs | thirtyfour |
version | 0.35.0 |
source | src |
created_at | 2019-11-30 13:09:50.283498 |
updated_at | 2024-11-25 14:54:29.205068 |
description | Thirtyfour is a Selenium / WebDriver library for Rust, for automated website UI testing. Tested on Chrome and Firefox, but any webdriver-capable browser should work. |
homepage | https://github.com/Vrtgs/thirtyfour |
repository | https://github.com/Vrtgs/thirtyfour |
max_upload_size | |
id | 185533 |
size | 564,882 |
Thirtyfour is a Selenium / WebDriver library for Rust, for automated website UI testing.
Page Object Model
)rustls-tls
: (Default) Use rustls to provide TLS support (via reqwest).native-tls
: Use native TLS (via reqwest).component
: (Default) Enable the Component
derive macro (via thirtyfour_macros).The examples assume you have chromedriver
running on your system.
You can use Selenium (see instructions below) or you can use chromedriver directly by downloading the chromedriver that matches your Chrome version, from here: https://chromedriver.chromium.org/downloads
Then run it like this:
chromedriver
To run this example:
cargo run --example tokio_async
use thirtyfour::prelude::*;
#[tokio::main]
async fn main() -> WebDriverResult<()> {
let caps = DesiredCapabilities::chrome();
let driver = WebDriver::new("http://localhost:9515", caps).await?;
// Navigate to https://wikipedia.org.
driver.goto("https://wikipedia.org").await?;
let elem_form = driver.find(By::Id("search-form")).await?;
// Find element from element.
let elem_text = elem_form.find(By::Id("searchInput")).await?;
// Type in the search terms.
elem_text.send_keys("selenium").await?;
// Click the search button.
let elem_button = elem_form.find(By::Css("button[type='submit']")).await?;
elem_button.click().await?;
// Look for header to implicitly wait for the page to load.
driver.find(By::ClassName("firstHeading")).await?;
assert_eq!(driver.title().await?, "Selenium - Wikipedia");
// Always explicitly close the browser.
driver.quit().await?;
Ok(())
}
The MSRV for thirtyfour
is currently latest, and so its guaranteed to run the latest stable release.
This work is dual-licensed under MIT or Apache 2.0. You can choose either license if you use this work.
See the NOTICE file for more details.
SPDX-License-Identifier: MIT OR Apache-2.0