use thirtyfour::prelude::*;
fn main() -> color_eyre::Result<()> {
let rt = tokio::runtime::Builder::new_current_thread().enable_all().build()?;
rt.block_on(run())
}
async fn run() -> color_eyre::Result<()> {
color_eyre::install()?;
let caps = DesiredCapabilities::chrome();
let driver = WebDriver::new("http://localhost:9515", caps).await?;
driver.goto("https://wikipedia.org").await?;
let elem_form = driver.find(By::Id("search-form")).await?;
let elem_text = elem_form.find(By::Id("searchInput")).await?;
elem_text.send_keys("selenium").await?;
let elem_button = elem_form.find(By::Css("button[type='submit']")).await?;
elem_button.click().await?;
driver.find(By::ClassName("firstHeading")).await?;
assert_eq!(driver.title().await?, "Selenium - Wikipedia");
driver.quit().await?;
Ok(())
}