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§
Navigate to the given URL.
Sourcefn 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_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.
Sourcefn 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 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.
Sourcefn refresh<'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,
Refresh the current page.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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_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.
Sourcefn 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_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.
Sourcefn 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_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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn close<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: '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,
Close the current page/tab.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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 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.
Sourcefn 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,
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.