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

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

Examples found in repository?
src/browser/mod.rs (line 107)
106
107
108
109
110
111
112
    pub fn default() -> Result<Self> {
        let launch_options = LaunchOptions::default_builder()
            .path(Some(default_executable().unwrap()))
            .build()
            .unwrap();
        Ok(Self::new(launch_options).unwrap())
    }

Trait Implementations§

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

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Get the TypeId of this object.