Skip to main content

BrowserDriver

Trait BrowserDriver 

Source
pub trait BrowserDriver: Send + Sync {
    // Required method
    fn snapshot(
        &self,
        target: Target,
    ) -> impl Future<Output = Result<PlumbSnapshot, CdpError>> + Send;

    // Provided method
    fn snapshot_all(
        &self,
        targets: Vec<Target>,
    ) -> impl Future<Output = Result<Vec<PlumbSnapshot>, CdpError>> + Send { ... }
}
Expand description

Async trait for browser drivers. Implementations are expected to be cheap to construct and expensive per-call.

Required Methods§

Source

fn snapshot( &self, target: Target, ) -> impl Future<Output = Result<PlumbSnapshot, CdpError>> + Send

Snapshot a single target.

Provided Methods§

Source

fn snapshot_all( &self, targets: Vec<Target>, ) -> impl Future<Output = Result<Vec<PlumbSnapshot>, CdpError>> + Send

Snapshot a list of targets, reusing a single browser session for the whole batch. The default implementation calls snapshot per target and is suitable for cheap drivers (e.g. FakeDriver). Real drivers MUST override this to launch the browser exactly once per batch.

Snapshots are returned in the same order as targets.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§