pub struct Chromedriver { /* private fields */ }Expand description
A wrapper struct for a spawned chromedriver process. Keep this alive until your test is complete.
Automatically terminates the spawned chromedriver process when dropped.
You can always manually call terminate, but the on-drop automation makes it much safer in
quickly panicking contexts, such as tests.
Implementations§
Source§impl Chromedriver
impl Chromedriver
Sourcepub async fn run(
config: ChromedriverRunConfig,
) -> Result<Chromedriver, Report<ChromeForTestingManagerError>>
pub async fn run( config: ChromedriverRunConfig, ) -> Result<Chromedriver, Report<ChromeForTestingManagerError>>
Resolve, download, and launch a chromedriver process.
§Errors
Returns an error if the runtime is not multithreaded, version resolution fails, the download fails, or the chromedriver process cannot be spawned.
Sourcepub async fn terminate(
self,
) -> Result<ExitStatus, Report<ChromeForTestingManagerError>>
pub async fn terminate( self, ) -> Result<ExitStatus, Report<ChromeForTestingManagerError>>
Gracefully terminate the chromedriver process with default timeouts (3s each).
§Errors
Returns an error if the process cannot be terminated within the timeout.
Sourcepub async fn terminate_with_timeouts(
self,
interrupt_timeout: Duration,
terminate_timeout: Duration,
) -> Result<ExitStatus, Report<ChromeForTestingManagerError>>
pub async fn terminate_with_timeouts( self, interrupt_timeout: Duration, terminate_timeout: Duration, ) -> Result<ExitStatus, Report<ChromeForTestingManagerError>>
Gracefully terminate the chromedriver process with custom timeouts.
§Errors
Returns an error if the process cannot be terminated within the given timeouts.
Sourcepub async fn with_session<T, E, F>(
&self,
f: F,
) -> Result<T, Report<ChromeForTestingManagerError>>
pub async fn with_session<T, E, F>( &self, f: F, ) -> Result<T, Report<ChromeForTestingManagerError>>
Execute an async closure with a WebDriver session.
The session will be automatically cleaned up after the closure completes.
§Errors
Returns an error if session creation fails or the user closure returns an error.
Sourcepub async fn with_custom_session<T, E, F>(
&self,
setup: impl Fn(&mut ChromeCapabilities) -> Result<(), WebDriverError>,
f: F,
) -> Result<T, Report<ChromeForTestingManagerError>>
pub async fn with_custom_session<T, E, F>( &self, setup: impl Fn(&mut ChromeCapabilities) -> Result<(), WebDriverError>, f: F, ) -> Result<T, Report<ChromeForTestingManagerError>>
Execute an async closure with a custom-configured WebDriver session.
The session will be automatically cleaned up after the closure completes.
§Errors
Returns an error if capability setup, session creation, or the user closure fails.