pub struct BrowserConfigBuilder { /* private fields */ }Implementations§
Source§impl BrowserConfigBuilder
impl BrowserConfigBuilder
Sourcepub fn window_size(self, width: u32, height: u32) -> Self
pub fn window_size(self, width: u32, height: u32) -> Self
Configure window size.
Sourcepub fn no_sandbox(self) -> Self
pub fn no_sandbox(self) -> Self
Configure sandboxing.
Sourcepub fn new_headless_mode(self) -> Self
pub fn new_headless_mode(self) -> Self
Configure the launch with the new headless mode.
Sourcepub fn headless_mode(self, mode: HeadlessMode) -> Self
pub fn headless_mode(self, mode: HeadlessMode) -> Self
Configure the launch with headless.
pub fn respect_https_errors(self) -> Self
pub fn port(self, port: u16) -> Self
pub fn with_max_bytes_allowed(self, max_bytes_allowed: Option<u64>) -> Self
Sourcepub fn with_max_redirects(self, max_redirects: Option<usize>) -> Self
pub fn with_max_redirects(self, max_redirects: Option<usize>) -> Self
Cap the number of Document-type redirect hops per navigation.
None disables enforcement (default, preserves Chromium’s own ~20-hop cap).
Some(n) aborts once a navigation chain exceeds n by emitting
net::ERR_TOO_MANY_REDIRECTS and calling Page.stopLoading.
Cap the number of main-frame cross-document navigations allowed per
goto call.
Defends against JS location.href / meta-refresh loops that bypass
HTTP-level redirect detection — each hop looks like a fresh document
to Chromium, so with_max_redirects alone cannot catch them. None
disables the guard (default).
pub fn launch_timeout(self, timeout: Duration) -> Self
pub fn request_timeout(self, timeout: Duration) -> Self
Sourcepub fn viewport(self, viewport: impl Into<Option<Viewport>>) -> Self
pub fn viewport(self, viewport: impl Into<Option<Viewport>>) -> Self
Configures the viewport of the browser, which defaults to 800x600.
None disables viewport emulation (i.e., it uses the browsers default
configuration, which fills the available space. This is similar to what
Playwright does when you provide null as the value of its viewport
option).
pub fn user_data_dir(self, data_dir: impl AsRef<Path>) -> Self
pub fn chrome_executable(self, path: impl AsRef<Path>) -> Self
pub fn chrome_detection(self, options: DetectionOptions) -> Self
Sourcepub fn prefer_edge(self) -> Self
pub fn prefer_edge(self) -> Self
Prefer Microsoft Edge over Chrome/Chromium during auto-detection.
Convenience over Self::chrome_detection that enables both
DetectionOptions::msedge and DetectionOptions::prefer_msedge so
Edge binaries are resolved first when both browsers are installed.
pub fn extension(self, extension: impl Into<String>) -> Self
pub fn extensions<I, S>(self, extensions: I) -> Self
pub fn env(self, key: impl Into<String>, val: impl Into<String>) -> Self
pub fn envs<I, K, V>(self, envs: I) -> Self
pub fn arg(self, arg: impl Into<String>) -> Self
pub fn args<I, S>(self, args: I) -> Self
pub fn disable_default_args(self) -> Self
pub fn enable_request_intercept(self) -> Self
pub fn disable_request_intercept(self) -> Self
pub fn enable_cache(self) -> Self
pub fn disable_cache(self) -> Self
Sourcepub fn set_service_worker_enabled(self, bypass: bool) -> Self
pub fn set_service_worker_enabled(self, bypass: bool) -> Self
Set service worker enabled.
Sourcepub fn allow_first_party_stylesheets(self, allow: bool) -> Self
pub fn allow_first_party_stylesheets(self, allow: bool) -> Self
When ignore_stylesheets is on, allow first-party CSS through.
Default true. Set false for strict block-all-CSS semantics.
Sourcepub fn allow_first_party_javascript(self, allow: bool) -> Self
pub fn allow_first_party_javascript(self, allow: bool) -> Self
Allow first-party scripts through downstream blockers (intercept
manager / adblock / blocklists). Default true.
Sourcepub fn allow_first_party_visuals(self, allow: bool) -> Self
pub fn allow_first_party_visuals(self, allow: bool) -> Self
When ignore_visuals is on, allow first-party images/media/fonts
through. Default true. Set false for strictly bandwidth-minimal
crawls that drop ALL visuals.
Sourcepub fn set_extra_headers(self, headers: Option<HashMap<String, String>>) -> Self
pub fn set_extra_headers(self, headers: Option<HashMap<String, String>>) -> Self
Set extra request headers.
Sourcepub fn set_whitelist_patterns(
self,
whitelist_patterns: Option<Vec<String>>,
) -> Self
pub fn set_whitelist_patterns( self, whitelist_patterns: Option<Vec<String>>, ) -> Self
Set whitelist patterns to allow through network interception allowing.
Sourcepub fn set_blacklist_patterns(
self,
blacklist_patterns: Option<Vec<String>>,
) -> Self
pub fn set_blacklist_patterns( self, blacklist_patterns: Option<Vec<String>>, ) -> Self
Set blacklist patterns to block through network interception.
Sourcepub fn channel_capacity(self, capacity: usize) -> Self
pub fn channel_capacity(self, capacity: usize) -> Self
Set the capacity of the channel between browser handle and handler. Defaults to 1000.
Sourcepub fn page_channel_capacity(self, capacity: usize) -> Self
pub fn page_channel_capacity(self, capacity: usize) -> Self
Set the capacity of the per-page mpsc channel carrying
TargetMessages from each Page to the handler.
Defaults to 2048 (the previous hard-coded value). Tune upward to
absorb bursts of commands without pushing them onto the
CommandFuture async-send fallback path; tune downward to apply
back-pressure sooner. Values of 0 are clamped to 1 at channel
creation time (tokio panics on a zero-capacity mpsc).
Sourcepub fn connection_retries(self, retries: u32) -> Self
pub fn connection_retries(self, retries: u32) -> Self
Set the number of WebSocket connection retry attempts with exponential backoff. Defaults to 4. Set to 0 for a single attempt with no retries.
Sourcepub fn build(self) -> Result<BrowserConfig, String>
pub fn build(self) -> Result<BrowserConfig, String>
Build the browser.
Trait Implementations§
Source§impl Clone for BrowserConfigBuilder
impl Clone for BrowserConfigBuilder
Source§fn clone(&self) -> BrowserConfigBuilder
fn clone(&self) -> BrowserConfigBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more