Ulyssedev / Rust-undetected-chromedriver

A rust implementation of ultrafunkamsterdam's undetected-chromedriver library based on thirtyfour
https://crates.io/crates/undetected-chromedriver
MIT License
33 stars 20 forks source link

Added the option to change WebDriver capabilities #7

Open huds2 opened 5 months ago

huds2 commented 5 months ago

I had to change the default capabilities for the WebDriver but the crate does not provide this function.

Renamed the chrome() function to chrome_caps and made it accept ChromeCapabilities as an argument.

Also created a chrome() function that calls chrome_caps with default ChromeCapabilities.

Usage example (changing the downloads directory):

let mut caps = DesiredCapabilities::chrome();
let mut prefs = HashMap::new();
prefs.insert("download.default_directory", "/path/to/directory");
caps.add_chrome_option("prefs", prefs)?;
let driver = chrome_caps(caps).await?;
Ulyssedev commented 5 months ago

Thanks for the contribution! I still have lots of changes to merge and will try to have a look at it as soon as possible