pub struct CdpSession { /* private fields */ }Expand description
A session over a CdpConnection.
Implementations§
Source§impl CdpSession
impl CdpSession
Sourcepub fn browser(conn: Arc<CdpConnection>) -> Self
pub fn browser(conn: Arc<CdpConnection>) -> Self
Browser-level session (no sessionId).
Sourcepub fn target(conn: Arc<CdpConnection>, session_id: impl Into<String>) -> Self
pub fn target(conn: Arc<CdpConnection>, session_id: impl Into<String>) -> Self
Target-level session for a known sessionId.
Sourcepub fn session_id(&self) -> Option<&str>
pub fn session_id(&self) -> Option<&str>
The session id, or None for the browser-level session.
pub fn set_default_timeout_ms(&self, ms: u64)
Sourcepub async fn send(&self, method: &str, params: Value) -> Result<Value>
pub async fn send(&self, method: &str, params: Value) -> Result<Value>
Send a CDP command, awaiting its response with the session’s default timeout.
Sourcepub async fn send_with_timeout(
&self,
method: &str,
params: Value,
timeout: Duration,
) -> Result<Value>
pub async fn send_with_timeout( &self, method: &str, params: Value, timeout: Duration, ) -> Result<Value>
Send a CDP command with an explicit timeout.
Sourcepub async fn send_no_timeout(
&self,
method: &str,
params: Value,
) -> Result<Value>
pub async fn send_no_timeout( &self, method: &str, params: Value, ) -> Result<Value>
Send a CDP command with no timeout (e.g. for long navigations).
Sourcepub fn subscribe(&self) -> Receiver<CdpEvent>
pub fn subscribe(&self) -> Receiver<CdpEvent>
Subscribe to all events on this session. Filter by event.method at the
call site. Subscribe before issuing the command whose events you want.
Sourcepub fn connection(&self) -> &Arc<CdpConnection> ⓘ
pub fn connection(&self) -> &Arc<CdpConnection> ⓘ
Back-reference to the underlying connection (for cross-session coordination).
Auto Trait Implementations§
impl !Freeze for CdpSession
impl !RefUnwindSafe for CdpSession
impl !UnwindSafe for CdpSession
impl Send for CdpSession
impl Sync for CdpSession
impl Unpin for CdpSession
impl UnsafeUnpin for CdpSession
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