pub struct Session { /* private fields */ }Expand description
High-level CDP session. Manages connection + tabs with event-driven lifecycle.
Implementations§
Source§impl Session
impl Session
Sourcepub async fn create_tab(&self, url: &str) -> Result<Tab>
pub async fn create_tab(&self, url: &str) -> Result<Tab>
Create a new tab/page
Sourcepub async fn evaluate(&self, tab: &Tab, js: &str) -> Result<Value>
pub async fn evaluate(&self, tab: &Tab, js: &str) -> Result<Value>
Evaluate JavaScript in a tab, return JSON result
Navigate to URL and wait for networkIdle lifecycle event
Sourcepub async fn wait_for<F>(
&self,
method: &str,
predicate: F,
timeout: Duration,
) -> Result<CdpEvent>
pub async fn wait_for<F>( &self, method: &str, predicate: F, timeout: Duration, ) -> Result<CdpEvent>
Wait for a CDP event matching method + predicate.
⚠️ Creates a NEW event subscription. Call BEFORE the action that
triggers the event to avoid race conditions. For navigation, use
navigate() instead.
Sourcepub async fn disconnect(self) -> Result<()>
pub async fn disconnect(self) -> Result<()>
Disconnect from browser
Sourcepub fn connection(&self) -> &Connection
pub fn connection(&self) -> &Connection
Access the underlying Connection (for direct CDP calls)
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Session
impl !UnwindSafe for Session
impl Freeze for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more