pub struct LaunchOptions {Show 16 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>,
}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.
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 all_chrome_args(&self) -> Vec<String>
pub fn all_chrome_args(&self) -> Vec<String>
Get all Chrome arguments (default + custom).
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 moreSource§impl Debug for LaunchOptions
impl Debug for LaunchOptions
Auto Trait Implementations§
impl Freeze for LaunchOptions
impl RefUnwindSafe for LaunchOptions
impl Send for LaunchOptions
impl Sync for LaunchOptions
impl Unpin for LaunchOptions
impl UnsafeUnpin for LaunchOptions
impl UnwindSafe for LaunchOptions
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