Skip to main content

CdpClient

Trait CdpClient 

Source
pub trait CdpClient: Send + Sync {
Show 26 methods // Required methods fn navigate<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn go_back<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn go_forward<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn refresh<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn click<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn type_text<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, selector: &'life1 str, text: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn fill<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, selector: &'life1 str, value: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn select_option<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, selector: &'life1 str, value: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn hover<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn press_key<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn scroll<'life0, 'async_trait>( &'life0 self, x: i32, y: i32, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn screenshot<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_html<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_text<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_url<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_title<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn evaluate_js<'life0, 'life1, 'async_trait>( &'life0 self, script: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Value, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn wait_for_selector<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 str, timeout_ms: u64, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn get_aria_tree<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn upload_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, selector: &'life1 str, path: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn close<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn new_tab<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_tabs<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<TabInfo>, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn switch_tab<'life0, 'life1, 'async_trait>( &'life0 self, tab_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn close_tab<'life0, 'life1, 'async_trait>( &'life0 self, tab_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn active_tab_id<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait;
}
Expand description

Trait abstracting Chrome DevTools Protocol operations.

Implementors include MockCdpClient (for tests) and a real ChromiumCdpClient (wrapping chromiumoxide) for production.

Required Methods§

Source

fn navigate<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Navigate to the given URL.

Source

fn go_back<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Go back in browser history.

Source

fn go_forward<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Go forward in browser history.

Source

fn refresh<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Refresh the current page.

Source

fn click<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Click an element matching the CSS selector.

Source

fn type_text<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, selector: &'life1 str, text: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Type text into the currently focused element.

Source

fn fill<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, selector: &'life1 str, value: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Clear and fill a form field.

Source

fn select_option<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, selector: &'life1 str, value: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Select an option in a <select> element.

Source

fn hover<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Hover over an element.

Source

fn press_key<'life0, 'life1, 'async_trait>( &'life0 self, key: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Press a keyboard key.

Source

fn scroll<'life0, 'async_trait>( &'life0 self, x: i32, y: i32, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Scroll by the given pixel offsets.

Source

fn screenshot<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Take a screenshot and return PNG bytes.

Source

fn get_html<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the full page HTML.

Source

fn get_text<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the visible text content.

Source

fn get_url<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the current page URL.

Source

fn get_title<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the current page title.

Source

fn evaluate_js<'life0, 'life1, 'async_trait>( &'life0 self, script: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Value, BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Evaluate a JavaScript expression and return the result.

Source

fn wait_for_selector<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 str, timeout_ms: u64, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Wait for an element matching the selector to appear.

Source

fn get_aria_tree<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the accessibility / ARIA tree as a string.

Source

fn upload_file<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, selector: &'life1 str, path: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Upload a file to a file input element.

Source

fn close<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Close the current page/tab.

Source

fn new_tab<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Open a new tab and navigate to the given URL. Returns the tab ID.

Source

fn list_tabs<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<TabInfo>, BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all open tabs with their metadata.

Source

fn switch_tab<'life0, 'life1, 'async_trait>( &'life0 self, tab_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Switch the active tab to the one with the given ID.

Source

fn close_tab<'life0, 'life1, 'async_trait>( &'life0 self, tab_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Close a specific tab by ID.

Source

fn active_tab_id<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the ID of the currently active tab.

Implementors§