pub struct LaunchOptions {Show 15 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 request_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§request_timeout: DurationDeadline for each CDP request, including Page.navigate. Default 30 s (chromiumoxide’s).
Raise it for dev servers whose first load is slow (e.g. Vite’s cold dependency optimizer).
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
Sourcepub fn request_timeout(self, timeout: Duration) -> Self
pub fn request_timeout(self, timeout: Duration) -> Self
Per-request CDP deadline (navigation included).
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 headless(self, on: bool) -> Self
pub fn headless(self, on: bool) -> Self
Show the browser window (false is the default headless mode). The action API is the
same in both modes.
Sourcepub fn imported_profile(
self,
root: impl Into<PathBuf>,
name: impl Into<String>,
import: ImportSpec,
) -> Self
pub fn imported_profile( self, root: impl Into<PathBuf>, name: impl Into<String>, import: ImportSpec, ) -> Self
Seed a named persistent profile from the user’s own browser, with consent. Pair with
the same browser’s executable (crate::browser_executable) so its sign-in encryption
key applies; crate::BrowserSession::attach_user_browser does both.
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.