pub struct ChromeConfig {
pub driver_executable_path: String,
pub host: Option<String>,
pub port: Option<u16>,
pub driver_flags: Vec<&'static str>,
pub capabilities: ChromeCapabilities,
pub sandbox: bool,
pub proxy: Option<ProxyConfiguration>,
pub remote_debugging_port: Option<u16>,
pub chrome_executable_path: Option<String>,
pub user_data_dir: Option<String>,
pub browser_flags: Option<Vec<String>>,
}Expand description
Configuration for Chrome browser and chromedriver.
This struct configures both the chromedriver process and the Chrome browser instance.
It supports three remote debugging modes via remote_debugging_port:
- Normal mode (
None): Chromedriver launches and manages Chrome automatically - Auto mode (
Some(0)): Rustenium starts Chrome first, then chromedriver attaches to it - Manual mode (
Some(port)): Connect to an existing Chrome instance on the specified port
§Examples
use rustenium::browsers::ChromeConfig;
// Basic configuration
let config = ChromeConfig {
driver_executable_path: "chromedriver".to_string(),
..Default::default()
};
// Headless mode with custom Chrome
let config = ChromeConfig {
driver_executable_path: "chromedriver".to_string(),
remote_debugging_port: Some(0), // Auto mode
chrome_executable_path: Some("/usr/bin/google-chrome".to_string()),
browser_flags: Some(vec!["--headless".to_string()]),
..Default::default()
};Fields§
§driver_executable_path: StringPath to the chromedriver executable.
host: Option<String>Host for the WebDriver server (default: localhost).
port: Option<u16>Port for the WebDriver server (auto-assigned if None).
driver_flags: Vec<&'static str>Additional flags to pass to chromedriver.
capabilities: ChromeCapabilitiesChrome capabilities for configuring browser behavior.
sandbox: boolWhether to enable Chrome sandbox (default: false).
proxy: Option<ProxyConfiguration>Optional proxy configuration.
remote_debugging_port: Option<u16>Chrome remote debugging port. Controls how Chrome is launched and managed:
None(default): Normal mode - chromedriver launches ChromeSome(0): Auto mode - Rustenium starts Chrome and manages it internallySome(port): Manual mode - Connect to existing Chrome running on specified port
chrome_executable_path: Option<String>Path to Chrome executable. Used when remote_debugging_port is Some(0).
Defaults to “google-chrome” if not specified.
user_data_dir: Option<String>Chrome user data directory. Used when remote_debugging_port is Some(0).
If not specified, uses a temporary directory.
browser_flags: Option<Vec<String>>Additional Chrome command-line arguments (browser flags).
Used when remote_debugging_port is Some(0).
Trait Implementations§
Source§impl Clone for ChromeConfig
impl Clone for ChromeConfig
Source§fn clone(&self) -> ChromeConfig
fn clone(&self) -> ChromeConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ChromeConfig
impl Debug for ChromeConfig
Source§impl Default for ChromeConfig
impl Default for ChromeConfig
Auto Trait Implementations§
impl Freeze for ChromeConfig
impl RefUnwindSafe for ChromeConfig
impl Send for ChromeConfig
impl Sync for ChromeConfig
impl Unpin for ChromeConfig
impl UnwindSafe for ChromeConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more