pub struct LaunchOptions {Show 14 fields
pub headless: bool,
pub mute_audio: bool,
pub profile: ProfileSpec,
pub chrome_path: Option<PathBuf>,
pub allow_system_chrome: bool,
pub use_system_chrome_only: bool,
pub viewport: (u32, u32),
pub launch_timeout: Duration,
pub extra_args: Vec<String>,
pub download_dir: Option<PathBuf>,
pub upload_root: Option<PathBuf>,
pub admission: Option<AdmissionHook>,
pub network: NetworkPolicy,
pub on_event: Option<EventSink>,
}Fields§
§headless: bool§mute_audio: boolPasses --mute-audio. Default true.
profile: ProfileSpec§chrome_path: Option<PathBuf>Explicit browser executable. When None, launch resolves Chrome for Testing with
chrome_for_testing_path. Ignored by Self::system_chrome_only.
allow_system_chrome: boolOpt-in: when Chrome for Testing is not installed, fall back to the system browser
(find_chrome). Off by default: regular Google Chrome on macOS leaves an APFS
code-sign clone of its bundle behind for every instance that does not shut down cleanly.
use_system_chrome_only: boolResolve only through find_chrome, ignoring chrome_path and Chrome for
Testing discovery. Off by default; enabled by Self::system_chrome_only.
viewport: (u32, u32)§launch_timeout: Duration§extra_args: Vec<String>Extra Chrome flags, with or without leading --.
download_dir: Option<PathBuf>Defaults to <profile>/downloads for temporary profiles and
<profile>/rightkit-downloads for persistent ones.
upload_root: Option<PathBuf>When set, upload refuses files outside this root.
admission: Option<AdmissionHook>Gates every navigation, input, and script action before it has any effect.
None admits everything (trusted callers).
network: NetworkPolicyNetwork/SSRF policy. Default blocks loopback, link-local, private ranges,
localhost, and file: unless allowed.
on_event: Option<EventSink>Receives start/stop/crash/denied lifecycle events (session id, reason, time).
Implementations§
Source§impl LaunchOptions
impl LaunchOptions
Sourcepub fn system_chrome(self) -> Self
pub fn system_chrome(self) -> Self
Opt in to the system Chrome/Chromium/Edge when Chrome for Testing is missing.
Sourcepub fn system_chrome_only(self) -> Self
pub fn system_chrome_only(self) -> Self
Use only system Chrome/Chromium/Edge via find_chrome. Ignores explicit
chrome_path and Chrome for Testing installs/environment overrides; errors
with BrowserError::ChromeNotFound when no system browser is found.
pub fn headed(self) -> Self
pub fn admission(self, hook: AdmissionHook) -> Self
pub fn network(self, policy: NetworkPolicy) -> Self
pub fn on_event(self, f: impl Fn(&BrowserEvent) + Send + Sync + 'static) -> Self
pub fn named_profile( self, root: impl Into<PathBuf>, name: impl Into<String>, ) -> Self
Sourcepub fn profile_dir(self, path: impl Into<PathBuf>) -> Self
pub fn profile_dir(self, path: impl Into<PathBuf>) -> Self
Use an existing absolute Chrome user-data directory, including paths with spaces or other filesystem-supported characters. Validated at launch; never created or deleted. The caller owns exclusive access to this directory.