Skip to main content

CdpAdapter

Struct CdpAdapter 

Source
pub struct CdpAdapter<T: ConnectionTransport + Send + Sync> {
    pub session: Arc<Mutex<CdpSession<T>>>,
    pub page_targets: Arc<Mutex<HashMap<TargetId, TargetInfo>>>,
    pub mouse: Arc<CdpMouse>,
    pub human_mouse: Arc<HumanMouse<CdpMouse>>,
    pub keyboard: Arc<CdpKeyboard<T>>,
    pub touchscreen: Arc<CdpTouchscreen>,
}

Fields§

§session: Arc<Mutex<CdpSession<T>>>§page_targets: Arc<Mutex<HashMap<TargetId, TargetInfo>>>§mouse: Arc<CdpMouse>§human_mouse: Arc<HumanMouse<CdpMouse>>§keyboard: Arc<CdpKeyboard<T>>§touchscreen: Arc<CdpTouchscreen>

Implementations§

Source§

impl CdpAdapter<WebsocketConnectionTransport>

Source§

impl<T: ConnectionTransport + Send + Sync> CdpAdapter<T>

Source

pub async fn listen_to_target_creation( &mut self, ) -> Result<(), CdpSessionSendError>

Source

pub async fn send_command( &mut self, command: impl Into<Command>, ) -> Result<CommandResponse, CdpSessionSendError>

Source

pub async fn navigate( &mut self, command: Navigate, ) -> Result<NavigateResult, NavigateError>

Source

pub async fn create_target( &mut self, command: CreateTarget, ) -> Result<TargetId, CreateTargetError>

Source

pub async fn fetch_node( &mut self, command: DescribeNode, ) -> Result<DomNode, NodesFetchError>

Source

pub async fn emulate_device_metrics( &mut self, command: SetDeviceMetricsOverride, ) -> Result<(), EmulateDeviceMetricsError>

Source

pub async fn locate( &mut self, selector: &str, ) -> Result<Option<DomNode>, LocateError>

Find the first element matching selector (CSS). Returns None if not found.

Source

pub async fn locate_all( &mut self, selector: &str, ) -> Result<Vec<DomNode>, LocateError>

Find all elements matching selector (CSS).

Source

pub async fn wait_for( &mut self, selector: &str, timeout: Duration, ) -> Result<DomNode, LocateError>

Poll until the first element matching selector appears, or timeout elapses.

Source

pub async fn wait_for_all( &mut self, selector: &str, timeout: Duration, ) -> Result<Vec<DomNode>, LocateError>

Poll until at least one element matching selector appears, or timeout elapses.

Source

pub async fn layout_metrics( &mut self, ) -> Result<GetLayoutMetricsResult, CdpCommandResultError>

Source

pub async fn screenshot( &mut self, screenshot: CaptureScreenshot, save_path: Option<String>, ) -> Result<String, ScreenshotError>

Source

pub async fn evaluate_script( &mut self, expression: &str, await_promise: bool, ) -> Result<EvaluateResult, EvaluateScriptError>

Source

pub async fn add_preload_script( &mut self, command: AddScriptToEvaluateOnNewDocument, ) -> Result<ScriptIdentifier, PreloadScriptError>

Source

pub async fn remove_preload_script( &mut self, command: RemoveScriptToEvaluateOnNewDocument, ) -> Result<(), PreloadScriptError>

Source

pub async fn close(&mut self)

Trait Implementations§

Source§

impl<T: Clone + ConnectionTransport + Send + Sync> Clone for CdpAdapter<T>

Source§

fn clone(&self) -> CdpAdapter<T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<T> Freeze for CdpAdapter<T>

§

impl<T> !RefUnwindSafe for CdpAdapter<T>

§

impl<T> Send for CdpAdapter<T>

§

impl<T> Sync for CdpAdapter<T>

§

impl<T> Unpin for CdpAdapter<T>

§

impl<T> UnsafeUnpin for CdpAdapter<T>

§

impl<T> !UnwindSafe for CdpAdapter<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more