Struct headless_chrome::browser::LaunchOptionsBuilder
source · pub struct LaunchOptionsBuilder<'a> { /* private fields */ }
Expand description
Builder for LaunchOptions
.
Implementations§
source§impl<'a> LaunchOptionsBuilder<'a>
impl<'a> LaunchOptionsBuilder<'a>
sourcepub fn headless(&mut self, value: bool) -> &mut Self
pub fn headless(&mut self, value: bool) -> &mut Self
Determines whether to run headless version of the browser. Defaults to true.
sourcepub fn sandbox(&mut self, value: bool) -> &mut Self
pub fn sandbox(&mut self, value: bool) -> &mut Self
Determines whether to run the browser with a sandbox.
sourcepub fn enable_gpu(&mut self, value: bool) -> &mut Self
pub fn enable_gpu(&mut self, value: bool) -> &mut Self
Determines whether to enable GPU or not. Default to false.
sourcepub fn enable_logging(&mut self, value: bool) -> &mut Self
pub fn enable_logging(&mut self, value: bool) -> &mut Self
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
sourcepub fn window_size(&mut self, value: Option<(u32, u32)>) -> &mut Self
pub fn window_size(&mut self, value: Option<(u32, u32)>) -> &mut Self
Launch the browser with a specific window width and height.
sourcepub fn port(&mut self, value: Option<u16>) -> &mut Self
pub fn port(&mut self, value: Option<u16>) -> &mut Self
Launch the browser with a specific debugging port.
sourcepub fn ignore_certificate_errors(&mut self, value: bool) -> &mut Self
pub fn ignore_certificate_errors(&mut self, value: bool) -> &mut Self
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
sourcepub fn path(&mut self, value: Option<PathBuf>) -> &mut Self
pub fn path(&mut self, value: Option<PathBuf>) -> &mut Self
Path for Chrome or Chromium.
If unspecified, the create will try to automatically detect a suitable binary.
sourcepub fn user_data_dir(&mut self, value: Option<PathBuf>) -> &mut Self
pub fn user_data_dir(&mut self, value: Option<PathBuf>) -> &mut Self
User Data (Profile) to use.
If unspecified, a new temp directory is created and used on every launch.
sourcepub fn extensions(&mut self, value: Vec<&'a OsStr>) -> &mut Self
pub fn extensions(&mut self, value: Vec<&'a OsStr>) -> &mut Self
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
sourcepub fn args(&mut self, value: Vec<&'a OsStr>) -> &mut Self
pub fn args(&mut self, value: Vec<&'a OsStr>) -> &mut Self
Additional arguments to pass to the browser instance. The list of Chromium flags can be found: http://peter.sh/experiments/chromium-command-line-switches/.
sourcepub fn disable_default_args(&mut self, value: bool) -> &mut Self
pub fn disable_default_args(&mut self, value: bool) -> &mut Self
Disable default arguments
sourcepub fn idle_browser_timeout(&mut self, value: Duration) -> &mut Self
pub fn idle_browser_timeout(&mut self, value: Duration) -> &mut Self
How long to keep the WebSocket to the browser for after not receiving any events from it Defaults to 30 seconds
sourcepub fn process_envs(
&mut self,
value: Option<HashMap<String, String>>
) -> &mut Self
pub fn process_envs( &mut self, value: Option<HashMap<String, String>> ) -> &mut Self
Environment variables to set for the Chromium process. Passes value through to std::process::Command::envs.
sourcepub fn proxy_server(&mut self, value: Option<&'a str>) -> &mut Self
pub fn proxy_server(&mut self, value: Option<&'a str>) -> &mut Self
Setup the proxy server for headless chrome instance
sourcepub fn build(&self) -> Result<LaunchOptions<'a>, LaunchOptionsBuilderError>
pub fn build(&self) -> Result<LaunchOptions<'a>, LaunchOptionsBuilderError>
Trait Implementations§
source§impl<'a> Clone for LaunchOptionsBuilder<'a>
impl<'a> Clone for LaunchOptionsBuilder<'a>
source§fn clone(&self) -> LaunchOptionsBuilder<'a>
fn clone(&self) -> LaunchOptionsBuilder<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl<'a> Freeze for LaunchOptionsBuilder<'a>
impl<'a> RefUnwindSafe for LaunchOptionsBuilder<'a>
impl<'a> Send for LaunchOptionsBuilder<'a>
impl<'a> Sync for LaunchOptionsBuilder<'a>
impl<'a> Unpin for LaunchOptionsBuilder<'a>
impl<'a> UnwindSafe for LaunchOptionsBuilder<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more