pub struct SessionOptionsBuilder { /* private fields */ }Expand description
Builder for SessionOptions with fluent methods.
All fields default to the same values as SessionOptions::default.
Call build to validate and produce a SessionOptions.
Implementations§
Source§impl SessionOptionsBuilder
impl SessionOptionsBuilder
Sourcepub fn chrome_path(self, chrome_path: impl Into<PathBuf>) -> Self
pub fn chrome_path(self, chrome_path: impl Into<PathBuf>) -> Self
Set the path to the Chrome/Chromium executable.
Sourcepub fn profile(self, profile: impl Into<String>) -> Self
pub fn profile(self, profile: impl Into<String>) -> Self
Set the profile name (default: "default").
Sourcepub fn incognito(self, incognito: bool) -> Self
pub fn incognito(self, incognito: bool) -> Self
Enable or disable incognito mode (default: false).
Sourcepub fn attach(self, attach: bool) -> Self
pub fn attach(self, attach: bool) -> Self
Attach to an existing Chrome CDP endpoint (default: false).
Sourcepub fn frame_id(self, frame_id: impl Into<String>) -> Self
pub fn frame_id(self, frame_id: impl Into<String>) -> Self
Set an explicit frame ID within the target.
Sourcepub fn interaction_mode(self, mode: InteractionMode) -> Self
pub fn interaction_mode(self, mode: InteractionMode) -> Self
Set the pointer movement strategy (default: InteractionMode::Human).
Sourcepub fn policy(self, policy: BrowserPolicy) -> Self
pub fn policy(self, policy: BrowserPolicy) -> Self
Set an explicit BrowserPolicy for the session.
When set, crate::browser::session::BrowserSession::start will use this policy instead of
creating a development policy. Equivalent to calling
crate::browser::session::BrowserSession::start_with_policy directly.
Sourcepub fn policy_preset(
self,
preset: PolicyPreset,
workspace_root: impl AsRef<Path>,
) -> Result<Self, Box<dyn Error>>
pub fn policy_preset( self, preset: PolicyPreset, workspace_root: impl AsRef<Path>, ) -> Result<Self, Box<dyn Error>>
Set the policy from a crate::browser::policy::PolicyPreset using the given workspace root.
This is a convenience wrapper around BrowserPolicy::from_preset.
When the builder already has a policy set, this replaces it.
Sourcepub fn build(self) -> BrowserResult<SessionOptions>
pub fn build(self) -> BrowserResult<SessionOptions>
Validate the accumulated options and return a SessionOptions.
This calls SessionOptions::validate internally.
Trait Implementations§
Source§impl Clone for SessionOptionsBuilder
impl Clone for SessionOptionsBuilder
Source§fn clone(&self) -> SessionOptionsBuilder
fn clone(&self) -> SessionOptionsBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SessionOptionsBuilder
impl Debug for SessionOptionsBuilder
Auto Trait Implementations§
impl Freeze for SessionOptionsBuilder
impl RefUnwindSafe for SessionOptionsBuilder
impl Send for SessionOptionsBuilder
impl Sync for SessionOptionsBuilder
impl Unpin for SessionOptionsBuilder
impl UnsafeUnpin for SessionOptionsBuilder
impl UnwindSafe for SessionOptionsBuilder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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