LaunchOptions

Struct LaunchOptions 

Source
pub struct LaunchOptions<'a> {
Show 17 fields pub headless: bool, pub sandbox: bool, pub devtools: bool, pub enable_gpu: bool, pub enable_logging: bool, pub window_size: Option<(u32, u32)>, pub port: Option<u16>, pub ignore_certificate_errors: bool, pub path: Option<PathBuf>, pub user_data_dir: Option<PathBuf>, pub extensions: Vec<&'a OsStr>, pub args: Vec<&'a OsStr>, pub ignore_default_args: Vec<&'a OsStr>, pub disable_default_args: bool, pub idle_browser_timeout: Duration, pub process_envs: Option<HashMap<String, String>>, pub proxy_server: Option<&'a str>,
}
Expand description

Represents the way in which Chrome is run. By default it will search for a Chrome binary on the system, use an available port for debugging, and start in headless mode.

Fields§

§headless: bool

Determines whether to run headless version of the browser. Defaults to true.

§sandbox: bool

Determines whether to run the browser with a sandbox.

§devtools: bool

Automatically open devtools for tabs. Forces headless to be false

§enable_gpu: bool

Determines whether to enable GPU or not. Default to false.

§enable_logging: bool

Determines whether to run the browser with logging enabled (this can cause unwanted new shell window in Windows 10 and above). Check https://github.com/rust-headless-chrome/rust-headless-chrome/issues/371

§window_size: Option<(u32, u32)>

Launch the browser with a specific window width and height.

§port: Option<u16>

Launch the browser with a specific debugging port.

§ignore_certificate_errors: bool

Determines whether SSL certificates should be verified. This is unsafe and can lead to MiTM attacks. Make sure you understand the risks See https://www.owasp.org/index.php/Man-in-the-middle_attack

§path: Option<PathBuf>

Path for Chrome or Chromium.

If unspecified, the create will try to automatically detect a suitable binary.

§user_data_dir: Option<PathBuf>

User Data (Profile) to use.

If unspecified, a new temp directory is created and used on every launch.

§extensions: Vec<&'a OsStr>

A list of Chrome extensions to load.

An extension should be a path to a folder containing the extension code. CRX files cannot be used directly and must be first extracted.

Note that Chrome does not support loading extensions in headless-mode. See https://bugs.chromium.org/p/chromium/issues/detail?id=706008#c5

§args: Vec<&'a OsStr>

Additional arguments to pass to the browser instance. The list of Chromium flags can be found: http://peter.sh/experiments/chromium-command-line-switches/.

§ignore_default_args: Vec<&'a OsStr>

Ignore a default given flag

§disable_default_args: bool

Disable default arguments

§idle_browser_timeout: Duration

How long to keep the WebSocket to the browser for after not receiving any events from it Defaults to 30 seconds

§process_envs: Option<HashMap<String, String>>

Environment variables to set for the Chromium process. Passes value through to std::process::Command::envs.

§proxy_server: Option<&'a str>

Setup the proxy server for headless chrome instance

Implementations§

Trait Implementations§

Source§

impl<'a> Clone for LaunchOptions<'a>

Source§

fn clone(&self) -> LaunchOptions<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for LaunchOptions<'a>

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
Source§

impl Hash for LaunchOptions<'_>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<'a> PartialEq for LaunchOptions<'a>

Source§

fn eq(&self, other: &LaunchOptions<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a> Eq for LaunchOptions<'a>

Source§

impl<'a> StructuralPartialEq for LaunchOptions<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for LaunchOptions<'a>

§

impl<'a> RefUnwindSafe for LaunchOptions<'a>

§

impl<'a> Send for LaunchOptions<'a>

§

impl<'a> Sync for LaunchOptions<'a>

§

impl<'a> Unpin for LaunchOptions<'a>

§

impl<'a> UnwindSafe for LaunchOptions<'a>

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<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, 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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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> ErasedDestructor for T
where T: 'static,