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:
Self::with_capsmutates theChromeCapabilitiesbefore the session opens (e.g. unset headless, add Chrome args).Self::with_configreceives theWebDriverBuilderand may configure the element poller, request timeout, user-agent, or keep-alive flag.
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>
impl<'a, B> SessionBuilder<'a, DefaultCaps, B>
Sourcepub fn with_caps<F>(self, f: F) -> SessionBuilder<'a, CapsSetup<F>, B>
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>
impl<'a, C> SessionBuilder<'a, C, DefaultConfig>
Sourcepub fn with_config<F>(self, f: F) -> SessionBuilder<'a, C, ConfigSetup<F>>
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,
impl<C, B> SessionBuilder<'_, C, B>where
C: ApplyCaps,
B: ApplyConfig,
Sourcepub async fn run<T, E, F>(
self,
f: F,
) -> Result<T, Report<ChromeForTestingManagerError>>
pub async fn run<T, E, F>( self, f: F, ) -> Result<T, Report<ChromeForTestingManagerError>>
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.