pub struct LaunchOptions<'a> {
Show 15 fields pub headless: bool, pub sandbox: 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 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.

§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/.

§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 copy 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<'a> Default for LaunchOptions<'a>

source§

fn default() -> Self

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

Auto Trait Implementations§

§

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

§

type Output = T

Should always be Self
source§

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

§

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

§

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

§

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

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

§

fn vzip(self) -> V