pub struct CDPSession { /* private fields */ }Expand description
A Chrome DevTools Protocol session for a page or browser context.
CDPSession is only available in Chromium-based browsers.
Implementations§
Source§impl CDPSession
impl CDPSession
Sourcepub fn new(
parent: ParentOrConnection,
type_name: String,
guid: Arc<str>,
initializer: Value,
) -> Result<Self>
pub fn new( parent: ParentOrConnection, type_name: String, guid: Arc<str>, initializer: Value, ) -> Result<Self>
Creates a new CDPSession from protocol initialization.
Called by the object factory when the server sends a __create__ message.
Sourcepub async fn send(&self, method: &str, params: Option<Value>) -> Result<Value>
pub async fn send(&self, method: &str, params: Option<Value>) -> Result<Value>
Send a CDP command and return the result.
§Arguments
method- The CDP method name (e.g.,"Runtime.evaluate")params- Optional JSON parameters for the method
§Errors
Returns error if:
- The session has been detached
- The CDP method fails
- Communication with browser process fails
See: https://playwright.dev/docs/api/class-cdpsession#cdp-session-send
Sourcepub async fn detach(&self) -> Result<()>
pub async fn detach(&self) -> Result<()>
Detach the CDP session from the target.
After detaching, the session can no longer be used to send commands.
§Errors
Returns error if:
- The session has already been detached
- Communication with browser process fails
See: https://playwright.dev/docs/api/class-cdpsession#cdp-session-detach
Trait Implementations§
Source§impl Clone for CDPSession
impl Clone for CDPSession
Source§fn clone(&self) -> CDPSession
fn clone(&self) -> CDPSession
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !Freeze for CDPSession
impl !RefUnwindSafe for CDPSession
impl Send for CDPSession
impl Sync for CDPSession
impl Unpin for CDPSession
impl UnsafeUnpin for CDPSession
impl !UnwindSafe 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