pub struct ChromeOptions { /* private fields */ }
Expand description
Utility struct to adjust the chrome browser session
For more info pls check the chromedriver docs at https://chromedriver.chromium.org/capabilities
Implementations§
Source§impl ChromeOptions
impl ChromeOptions
pub fn new() -> Self
Sourcepub fn add_args(&mut self, args: Vec<&str>) -> &mut Self
pub fn add_args(&mut self, args: Vec<&str>) -> &mut Self
List of arguments to be passed to the Chrome browser on launch
§Examples
let args = vec!["--headless","--window-size=800,600"];
let mut ch = ChromeOptions::new();
ch.add_args(args);
Sourcepub fn add_binary(&mut self, path: &str) -> &mut Self
pub fn add_binary(&mut self, path: &str) -> &mut Self
Path to chrome executable
Sourcepub fn add_extensions(&mut self, extensions: Vec<&str>) -> &mut Self
pub fn add_extensions(&mut self, extensions: Vec<&str>) -> &mut Self
Each item in the vec should be a base-64 encoded packed Chrome extension (.crx)
Sourcepub fn add_local_state(&mut self, local_state: HashMap<&str, &str>) -> &mut Self
pub fn add_local_state(&mut self, local_state: HashMap<&str, &str>) -> &mut Self
Local state preferences’ names and values.
Sourcepub fn add_prefs(&mut self, prefs: HashMap<&str, &str>) -> &mut Self
pub fn add_prefs(&mut self, prefs: HashMap<&str, &str>) -> &mut Self
User profile preferences’ names and values.
Sourcepub fn add_detach(&mut self, detach: bool) -> &mut Self
pub fn add_detach(&mut self, detach: bool) -> &mut Self
If false, Chrome will be quit when ChromeDriver is killed even if the session is still active
Sourcepub fn add_debugger_address(&mut self, address: &str) -> &mut Self
pub fn add_debugger_address(&mut self, address: &str) -> &mut Self
An address of a Chrome debugger server to connect to, for example, e.g. “127.0.0.1:38947”
Sourcepub fn add_exclude_switches(&mut self, switches: Vec<&str>) -> &mut Self
pub fn add_exclude_switches(&mut self, switches: Vec<&str>) -> &mut Self
List of Chrome command line switches to exclude
Sourcepub fn add_minidump_path(&mut self, path: &str) -> &mut Self
pub fn add_minidump_path(&mut self, path: &str) -> &mut Self
Only for Linux. Directory to store Chrome minidumps
Sourcepub fn add_mobile_emulation(&mut self, device: MobileDevice) -> &mut Self
pub fn add_mobile_emulation(&mut self, device: MobileDevice) -> &mut Self
See the MobileDevice struct for more info
Sourcepub fn add_perf_logging_prefs(&mut self, prefs: PerfLoggingPrefs) -> &mut Self
pub fn add_perf_logging_prefs(&mut self, prefs: PerfLoggingPrefs) -> &mut Self
Pls check chromedriver docs for more info
Sourcepub fn add_window_types(&mut self, window_types: Vec<&str>) -> &mut Self
pub fn add_window_types(&mut self, window_types: Vec<&str>) -> &mut Self
A list of window types that will appear in the list of window handles.