Skip to main content

SessionBuilder

Struct SessionBuilder 

Source
pub struct SessionBuilder<'a, C, B> { /* private fields */ }
Expand description

A scoped, chainable builder for opening a thirtyfour Session against a running Chromedriver.

Obtained via Chromedriver::session. Optional setup steps:

Call Self::run to open the session and execute the user closure inside scoped, panic-safe cleanup that always calls WebDriver::quit().await.

Implementations§

Source§

impl<'a, B> SessionBuilder<'a, DefaultCaps, B>

Source

pub fn with_caps<F>(self, f: F) -> SessionBuilder<'a, CapsSetup<F>, B>

Provide a closure that mutates the ChromeCapabilities used to create the session.

Source§

impl<'a, C> SessionBuilder<'a, C, DefaultConfig>

Source

pub fn with_config<F>(self, f: F) -> SessionBuilder<'a, C, ConfigSetup<F>>

Provide a closure that configures the WebDriverBuilder before the session is opened.

Source§

impl<C, B> SessionBuilder<'_, C, B>
where C: ApplyCaps, B: ApplyConfig,

Source

pub async fn run<T, E, F>( self, f: F, ) -> Result<T, Report<ChromeForTestingManagerError>>
where F: for<'b> AsyncFnOnce(&'b Session) -> Result<T, E>, E: IntoReportCollection<SendSync>,

Open a Session, hand it to the user closure, and tear it down once the closure resolves or panics.

Cleanup runs regardless of outcome. A panic in the user closure is caught, the session is quit, and the panic is resumed afterwards.

§Errors

Returns an error if capability setup, session creation, the user closure, or the quit call fails. A user error combined with a quit error is reported with the quit error attached as a child.

Auto Trait Implementations§

§

impl<'a, C, B> Freeze for SessionBuilder<'a, C, B>
where C: Freeze, B: Freeze,

§

impl<'a, C, B> !RefUnwindSafe for SessionBuilder<'a, C, B>

§

impl<'a, C, B> Send for SessionBuilder<'a, C, B>
where C: Send, B: Send,

§

impl<'a, C, B> Sync for SessionBuilder<'a, C, B>
where C: Sync, B: Sync,

§

impl<'a, C, B> Unpin for SessionBuilder<'a, C, B>
where C: Unpin, B: Unpin,

§

impl<'a, C, B> UnsafeUnpin for SessionBuilder<'a, C, B>
where C: UnsafeUnpin, B: UnsafeUnpin,

§

impl<'a, C, B> !UnwindSafe for SessionBuilder<'a, C, B>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<O> ObjectMarkerFor<Local> for O
where O: 'static,

Source§

impl<O> ObjectMarkerFor<SendSync> for O
where O: 'static + Send + Sync,

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> Sink for T
where T: Send + 'static,