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>
impl CdpAdapter<WebsocketConnectionTransport>
pub fn new( session: Arc<TokioMutex<CdpSession<WebsocketConnectionTransport>>>, ) -> Self
Source§impl<T: ConnectionTransport + Send + Sync> CdpAdapter<T>
impl<T: ConnectionTransport + Send + Sync> CdpAdapter<T>
pub async fn listen_to_target_creation( &mut self, ) -> Result<(), CdpSessionSendError>
pub async fn send_command( &mut self, command: impl Into<Command>, ) -> Result<CommandResponse, CdpSessionSendError>
pub async fn create_target( &mut self, command: CreateTarget, ) -> Result<TargetId, CreateTargetError>
pub async fn fetch_node( &mut self, command: DescribeNode, ) -> Result<DomNode, NodesFetchError>
pub async fn emulate_device_metrics( &mut self, command: SetDeviceMetricsOverride, ) -> Result<(), EmulateDeviceMetricsError>
Sourcepub async fn locate(
&mut self,
selector: &str,
) -> Result<Option<DomNode>, LocateError>
pub async fn locate( &mut self, selector: &str, ) -> Result<Option<DomNode>, LocateError>
Find the first element matching selector (CSS). Returns None if not found.
Sourcepub async fn locate_all(
&mut self,
selector: &str,
) -> Result<Vec<DomNode>, LocateError>
pub async fn locate_all( &mut self, selector: &str, ) -> Result<Vec<DomNode>, LocateError>
Find all elements matching selector (CSS).
Sourcepub async fn wait_for(
&mut self,
selector: &str,
timeout: Duration,
) -> Result<DomNode, LocateError>
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.
Sourcepub async fn wait_for_all(
&mut self,
selector: &str,
timeout: Duration,
) -> Result<Vec<DomNode>, LocateError>
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.
pub async fn layout_metrics( &mut self, ) -> Result<GetLayoutMetricsResult, CdpCommandResultError>
pub async fn screenshot( &mut self, screenshot: CaptureScreenshot, save_path: Option<String>, ) -> Result<String, ScreenshotError>
pub async fn evaluate_script( &mut self, expression: &str, await_promise: bool, ) -> Result<EvaluateResult, EvaluateScriptError>
pub async fn add_preload_script( &mut self, command: AddScriptToEvaluateOnNewDocument, ) -> Result<ScriptIdentifier, PreloadScriptError>
pub async fn remove_preload_script( &mut self, command: RemoveScriptToEvaluateOnNewDocument, ) -> Result<(), PreloadScriptError>
pub async fn close(&mut self)
Trait Implementations§
Source§impl<T: Clone + ConnectionTransport + Send + Sync> Clone for CdpAdapter<T>
impl<T: Clone + ConnectionTransport + Send + Sync> Clone for CdpAdapter<T>
Source§fn clone(&self) -> CdpAdapter<T>
fn clone(&self) -> CdpAdapter<T>
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<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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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