Skip to main content

LaunchOptions

Struct LaunchOptions 

Source
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: bool

Passes --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: bool

Opt-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: bool

Resolve 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: NetworkPolicy

Network/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

Source

pub fn system_chrome(self) -> Self

Opt in to the system Chrome/Chromium/Edge when Chrome for Testing is missing.

Source

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.

Source

pub fn headed(self) -> Self

Source

pub fn admission(self, hook: AdmissionHook) -> Self

Source

pub fn network(self, policy: NetworkPolicy) -> Self

Source

pub fn on_event(self, f: impl Fn(&BrowserEvent) + Send + Sync + 'static) -> Self

Source

pub fn named_profile( self, root: impl Into<PathBuf>, name: impl Into<String>, ) -> Self

Source

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.

Trait Implementations§

Source§

impl Clone for LaunchOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LaunchOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LaunchOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more