lw_webdriver/lib.rs
1//! This crate allows you to control a web browser (Firefox or chrome) easily.
2//! It does not use selenium, which is much more lightweight.
3//! 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).
4//! This crate can launch the driver and kill his process after, but if one is already running, it will be used.
5//! A lot of improvements can be done. Feel free to contribute.
6//!
7//! # Example
8//!
9//! ```rust
10//! use lw_webdriver::{session::Session, enums::{Browser, Selector}};
11//! use std::{thread, time::Duration};
12//!
13//! // start session
14//! let mut session = Session::new(Browser::Firefox, false).unwrap();
15//!
16//! // load a website
17//! session.tabs[0].navigate("https://mubelotix.dev/").unwrap();
18//!
19//! // click a link
20//! let mut element = session.tabs[0].find(Selector::XPath, "//a[@href='https://www.kerbalspaceprogram.com/']").unwrap().unwrap();
21//! element.click().unwrap();
22//!
23//! # thread::sleep(Duration::from_secs(5));
24//! ```
25//!
26//! # Running tests
27//!
28//! Run tests one by one:
29//!
30//! ```ignore
31//! cargo test -- --test-threads=1
32//! ```
33
34pub mod session;
35pub mod enums;
36pub mod tab;
37pub mod elements;
38pub mod timeouts;
39pub mod error;
40mod http_requests;