Skip to main content

BrowserTab

Trait BrowserTab 

Source
pub trait BrowserTab: Send + Sync {
Show 35 methods // Required methods fn goto<'life0, 'life1, 'async_trait>( &'life0 self, url: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<PageContent, 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; fn type_<'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 press<'life0, 'life1, 'async_trait>( &'life0 self, combo: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn wait_for<'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 content<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<PageContent, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn query_all<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn evaluate<'life0, 'life1, 'async_trait>( &'life0 self, js: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Value, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn screenshot<'life0, 'async_trait>( &'life0 self, width: u32, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, 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; fn back<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<PageContent, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn forward<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<PageContent, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn reload<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<PageContent, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: '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 check<'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 uncheck<'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; // Provided methods fn wait_for_condition<'life0, 'life1, 'async_trait>( &'life0 self, cond: &'life1 BrowseWaitCondition, timeout_ms: u64, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn observe<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Observation, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn print_to_pdf<'life0, 'async_trait>( &'life0 self, width: u32, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn clear<'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 { ... } fn double_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 right_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 scroll<'life0, 'async_trait>( &'life0 self, delta_x: f64, delta_y: f64, ) -> Pin<Box<dyn Future<Output = Result<(), BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait { ... } fn scroll_into_view<'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 drag<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from_selector: &'life1 str, to_selector: &'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 { ... } fn get_value<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn evaluate_await<'life0, 'life1, 'async_trait>( &'life0 self, js: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Value, BrowserError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn is_closed(&self) -> bool { ... } fn tab_id(&self) -> Uuid { ... } fn as_any(&self) -> &dyn Any { ... } fn clear_progress_callback(&self) { ... } fn set_browse_progress_callback(&self, _cb: BrowseProgressCallback) { ... }
}
Expand description

Operations available on a single browser tab.

Implementors handle their own async runtime; this trait only defines the interface contract.

Uses #[async_trait] so that dyn BrowserTab remains object-safe while method bodies can be written as plain async fn. This matches the sibling AgentTool impls in this module and avoids the manual Pin<Box<dyn Future + 'a>> boilerplate that broke under edition 2024’s precise lifetime capture rules.

Required Methods§

Source

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

Navigate to url and return page content.

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 selector.

Source

fn type_<'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 an element matching selector.

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,

Fill (set value of) an element matching selector.

Source

fn press<'life0, 'life1, 'async_trait>( &'life0 self, combo: &'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 combo (e.g. "Enter", "Control+c").

Source

fn wait_for<'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 selector to appear.

Source

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

Get the current page content (markdown + html).

Source

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

Get text content of all elements matching selector.

Source

fn evaluate<'life0, 'life1, 'async_trait>( &'life0 self, js: &'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 JSON result.

Source

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

Capture a screenshot and return PNG bytes.

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 this tab.

Source

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

Navigate back in history. Returns the rendered page content.

Source

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

Navigate forward in history. Returns the rendered page content.

Source

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

Reload the current page. Returns the rendered page content.

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 check<'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,

Check a checkbox or radio input.

Source

fn uncheck<'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,

Uncheck a checkbox or radio input.

Provided Methods§

Source

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

Wait until a structured BrowseWaitCondition is satisfied.

Default: Visible(selector) delegates to wait_for; NetworkIdle / DomContentLoaded / Load resolve immediately on backends that don’t model in-flight traffic (mock/fallback). The native oxibrowser-core backend overrides this to honour real network-idle semantics with a quiet window, matching omp’s waitFor* helpers.

Source

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

Snapshot the page’s interactive surface (omp observe() parity).

Returns visible, interactive elements with stable ref_ids and selectors the agent can click/type/fill by. Default is an empty observation — only a JS-capable backend produces real entries. The returned selectors are [data-oxicode-ref="eN"]; that attribute is stamped on each returned element so the ref→element mapping stays exact within the snapshot.

Source

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

Export the current page to PDF and return raw PDF bytes. Returns a BrowserError::Screenshot (or a dedicated Pdf variant if added) on render or encode failure.

Source

fn clear<'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,

Clear the value of an input 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 double_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,

Double-click an element.

Source

fn right_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,

Right-click (context menu) an element.

Source

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

Scroll the page by delta pixels.

Source

fn scroll_into_view<'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,

Scroll an element into view.

Source

fn drag<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, from_selector: &'life1 str, to_selector: &'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,

Drag from one element to another.

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 get_value<'life0, 'life1, 'async_trait>( &'life0 self, selector: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String, BrowserError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get the value or text content of an element.

Source

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

Evaluate JS that may return a promise; awaits by default.

Source

fn is_closed(&self) -> bool

Returns true if this tab has been closed.

Source

fn tab_id(&self) -> Uuid

Return this tab’s unique ID, if the backend supports it. Defaults to Uuid::nil() for backends that don’t track tab identity.

Source

fn as_any(&self) -> &dyn Any

Support downcasting for backend-specific access.

Source

fn clear_progress_callback(&self)

Clear any registered progress callback for this tab. Defaults to no-op — only backends with callback registries override.

Source

fn set_browse_progress_callback(&self, _cb: BrowseProgressCallback)

Register a structured browse progress callback for this tab. Defaults to no-op — only backends with browse callback support override.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§