17 unstable releases (3 breaking)

0.4.1 Feb 5, 2020
0.4.0 Feb 5, 2020
0.3.4 Feb 1, 2020
0.3.3 Jan 29, 2020
0.1.7 Jan 21, 2020

#238 in Testing

Download history 1/week @ 2021-07-01 17/week @ 2021-07-15 2/week @ 2021-07-22 35/week @ 2021-07-29 18/week @ 2021-08-05 18/week @ 2021-08-12 17/week @ 2021-09-30 17/week @ 2021-10-07

137 downloads per month

MIT license

7.5MB
995 lines

lw-webdriver

This crate allows you to control a web browser (Firefox or chrome) easily. It does not use selenium, which is much more lightweight. It only uses geckodriver or chromedriver (you have to download the one you want to use depending on your browser and place it in your program's directory). This crate can launch the driver and kill his process after, but if one is already running, it will be used. A lot of improvements can be done. Feel free to contribute.

Example

use lw_webdriver::{session::Session, enums::{Browser, Selector}};
use std::{thread, time::Duration};

// start session
let mut session = Session::new(Browser::Firefox, false).unwrap();

// load a website
session.tabs[0].navigate("https://mubelotix.dev/").unwrap();

// click a link
let mut element = session.tabs[0].find(Selector::XPath, "//a[@href='https://www.kerbalspaceprogram.com/']").unwrap().unwrap();
element.click().unwrap();

Running tests

Run tests one by one:

cargo test -- --test-threads=1

License: MIT

Dependencies