pub struct LaunchOptions {Show 19 fields
pub engine: EngineType,
pub user_data_dir: Option<PathBuf>,
pub headless: bool,
pub slow_mo: u64,
pub verbose: bool,
pub args: Vec<String>,
pub extra_args: Vec<String>,
pub ignore_default_args: Vec<String>,
pub ignore_all_default_args: bool,
pub channel: Option<String>,
pub executable_path: Option<PathBuf>,
pub color_scheme: Option<ColorScheme>,
pub launch_timeout: Option<Duration>,
pub sandbox: bool,
pub node_executable: Option<PathBuf>,
pub node_working_dir: Option<PathBuf>,
pub automation_parity: bool,
pub fingerprint: Option<FingerprintProfile>,
pub downloads: DownloadSetting,
}Expand description
Options for launching a browser.
Fields§
§engine: EngineTypeThe browser engine to use.
user_data_dir: Option<PathBuf>Path to user data directory.
headless: boolRun in headless mode.
slow_mo: u64Slow down operations by this many milliseconds.
verbose: boolEnable verbose logging.
args: Vec<String>Additional Chrome arguments.
extra_args: Vec<String>Additional Chrome arguments appended after the compatibility args.
ignore_default_args: Vec<String>Browser Commander default arguments to omit.
ignore_all_default_args: boolOmit every Browser Commander and engine default argument.
channel: Option<String>Installed browser channel for Playwright/Puppeteer (for example, chrome).
executable_path: Option<PathBuf>Explicit path to a Chrome or Chromium executable.
color_scheme: Option<ColorScheme>Color scheme to emulate. None uses the system default.
launch_timeout: Option<Duration>Optional timeout for the browser launch handshake.
sandbox: boolWhether to run the browser with the Chromium sandbox enabled.
Defaults to true. Disable when running in environments where the
sandbox is unavailable (e.g. CI containers without the required
capabilities). This translates to the --no-sandbox /
--disable-setuid-sandbox Chromium flags.
node_executable: Option<PathBuf>Node.js executable for Playwright/Puppeteer fallback engines.
node_working_dir: Option<PathBuf>Working directory used to resolve Playwright/Puppeteer Node packages.
automation_parity: boolKeep navigator.webdriver false and the command line free of switches a
hand-started Chrome does not carry.
Defaults to true. Set to false to launch with the engine’s own
defaults, which is what the parity tests use as a negative control.
fingerprint: Option<FingerprintProfile>The environment pages should see: user agent, time zone, locale, core count, screen and the rest.
Applied over CDP once the browser is up, so it only works for the
chromiumoxide engine; see
fingerprint::profile for the field list
and presets for ready-made machines.
downloads: DownloadSettingManage the browser’s downloads: where they are saved, how they are named, and whether they outlive the browser.
Downloads are redirected over CDP, so this only works for the
chromiumoxide engine; the other engines refuse rather than accept a
setting they cannot honor. See downloads.
Implementations§
Source§impl LaunchOptions
impl LaunchOptions
Sourcepub fn engine(self, engine: EngineType) -> Self
pub fn engine(self, engine: EngineType) -> Self
Set the browser automation engine.
Sourcepub fn chromiumoxide() -> Self
pub fn chromiumoxide() -> Self
Create options for chromiumoxide engine.
Sourcepub fn fantoccini() -> Self
pub fn fantoccini() -> Self
Create options for fantoccini (WebDriver) engine.
Sourcepub fn playwright() -> Self
pub fn playwright() -> Self
Create options for Playwright through the Node.js CLI bridge.
Sourcepub fn user_data_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn user_data_dir(self, dir: impl Into<PathBuf>) -> Self
Set the user data directory.
Sourcepub fn with_extra_args(self, args: Vec<String>) -> Self
pub fn with_extra_args(self, args: Vec<String>) -> Self
Add Chrome arguments after the compatibility args field.
Sourcepub fn ignore_default_args(self, args: Vec<String>) -> Self
pub fn ignore_default_args(self, args: Vec<String>) -> Self
Omit selected Browser Commander defaults.
Sourcepub fn ignore_all_default_args(self) -> Self
pub fn ignore_all_default_args(self) -> Self
Omit every Browser Commander and engine default argument.
Sourcepub fn channel(self, channel: impl Into<String>) -> Self
pub fn channel(self, channel: impl Into<String>) -> Self
Select an installed browser channel for Playwright or Puppeteer.
Sourcepub fn executable_path(self, executable_path: impl Into<PathBuf>) -> Self
pub fn executable_path(self, executable_path: impl Into<PathBuf>) -> Self
Select an explicit Chrome or Chromium executable.
Sourcepub fn color_scheme(self, color_scheme: ColorScheme) -> Self
pub fn color_scheme(self, color_scheme: ColorScheme) -> Self
Set the color scheme for media emulation.
Sourcepub fn launch_timeout(self, timeout: Duration) -> Self
pub fn launch_timeout(self, timeout: Duration) -> Self
Override the browser launch timeout.
Sourcepub fn sandbox(self, sandbox: bool) -> Self
pub fn sandbox(self, sandbox: bool) -> Self
Enable or disable the Chromium sandbox for the launched browser.
Sourcepub fn node_executable(self, executable: impl Into<PathBuf>) -> Self
pub fn node_executable(self, executable: impl Into<PathBuf>) -> Self
Override the Node.js executable used by Playwright/Puppeteer engines.
Sourcepub fn node_working_dir(self, dir: impl Into<PathBuf>) -> Self
pub fn node_working_dir(self, dir: impl Into<PathBuf>) -> Self
Set the directory where Node resolves playwright or puppeteer.
Sourcepub fn automation_parity(self, automation_parity: bool) -> Self
pub fn automation_parity(self, automation_parity: bool) -> Self
Turn fingerprint parity with a hand-started Chrome on or off.
Sourcepub fn fingerprint(self, fingerprint: FingerprintProfile) -> Self
pub fn fingerprint(self, fingerprint: FingerprintProfile) -> Self
Set the environment pages should see.
Sourcepub fn downloads(self, downloads: impl Into<DownloadSetting>) -> Self
pub fn downloads(self, downloads: impl Into<DownloadSetting>) -> Self
Manage this browser’s downloads.
§Arguments
downloads-truefor the defaults,falsefor none, orDownloadOptions
Sourcepub fn all_chrome_args(&self) -> Vec<String>
pub fn all_chrome_args(&self) -> Vec<String>
Get all Chrome arguments (default + custom).
Sourcepub fn all_ignored_default_args(&self) -> Vec<String>
pub fn all_ignored_default_args(&self) -> Vec<String>
Engine default switches to suppress so the command line matches a hand-started Chrome.
Merged with the caller’s ignore_default_args, because a switch the
engine appends after the caller’s arguments cannot be countered by
passing a different value for it.
Sourcepub fn get_user_data_dir(&self) -> PathBuf
pub fn get_user_data_dir(&self) -> PathBuf
Get the user data directory, using a default if not specified.
Trait Implementations§
Source§impl Clone for LaunchOptions
impl Clone for LaunchOptions
Source§fn clone(&self) -> LaunchOptions
fn clone(&self) -> LaunchOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more