Skip to main content

BrowserDriver

Trait BrowserDriver 

Source
pub trait BrowserDriver: Send + Sync {
    // Required methods
    fn launch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 BrowserConfig,
    ) -> Pin<Box<dyn Future<Output = PunchResult<BrowserSession>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session: &'life1 mut BrowserSession,
        action: BrowserAction,
    ) -> Pin<Box<dyn Future<Output = PunchResult<BrowserResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn close<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session: &'life1 mut BrowserSession,
    ) -> Pin<Box<dyn Future<Output = PunchResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Trait for a browser automation driver — the engine behind the punches.

Implementations handle the actual CDP WebSocket communication. This trait defines the contract so drivers can be swapped or mocked in tests.

Required Methods§

Source

fn launch<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 BrowserConfig, ) -> Pin<Box<dyn Future<Output = PunchResult<BrowserSession>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Launch a browser instance and return a connected session.

Source

fn execute<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 mut BrowserSession, action: BrowserAction, ) -> Pin<Box<dyn Future<Output = PunchResult<BrowserResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute a browser action within the given session.

Source

fn close<'life0, 'life1, 'async_trait>( &'life0 self, session: &'life1 mut BrowserSession, ) -> Pin<Box<dyn Future<Output = PunchResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Close the browser session and clean up resources.

Implementors§