Struct headless_chrome::browser::LaunchOptions
source · 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§
source§impl<'a> LaunchOptions<'a>
impl<'a> LaunchOptions<'a>
pub fn default_builder() -> LaunchOptionsBuilder<'a>
Trait Implementations§
source§impl<'a> Clone for LaunchOptions<'a>
impl<'a> Clone for LaunchOptions<'a>
source§fn clone(&self) -> LaunchOptions<'a>
fn clone(&self) -> LaunchOptions<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more