pub trait BidiBrowser: Send + Sync {
type Transport: ConnectionTransport + Send + Sync + 'static;
type BrowserNode: Node + Send;
Show 41 methods
// Required methods
fn driver(&self) -> &BidiDriver<Self::Transport>;
fn driver_mut(&mut self) -> &mut BidiDriver<Self::Transport>;
fn build_node(
&self,
raw_node: NodeRemoteValue,
locator: Locator,
context: BrowsingContext,
) -> Self::BrowserNode;
fn close(self) -> impl Future<Output = Result<(), BrowserCloseError>> + Send;
// Provided methods
fn navigate(
&mut self,
url: &str,
) -> impl Future<Output = Result<NavigateResult, NavigateError>> + Send { ... }
fn navigate_with_options(
&mut self,
url: &str,
options: NavigateOptions,
) -> impl Future<Output = Result<NavigateResult, NavigateError>> + Send { ... }
fn close_context(
&mut self,
context: DomainBrowsingContext,
) -> impl Future<Output = Result<(), ContextCloseError>> + Send { ... }
fn create_context(
&mut self,
background: bool,
) -> impl Future<Output = Result<DomainBrowsingContext, ContextCreationError>> + Send { ... }
fn create_context_with_options(
&mut self,
background: bool,
options: CreateContextOptions,
) -> impl Future<Output = Result<DomainBrowsingContext, ContextCreationError>> + Send { ... }
fn find_nodes(
&mut self,
locator: Locator,
) -> impl Future<Output = Result<Vec<Self::BrowserNode>, FindNodesError>> + Send { ... }
fn find_nodes_with_options(
&mut self,
locator: Locator,
options: FindNodesOptions,
) -> impl Future<Output = Result<Vec<Self::BrowserNode>, FindNodesError>> + Send { ... }
fn find_node(
&mut self,
locator: Locator,
) -> impl Future<Output = Result<Option<Self::BrowserNode>, FindNodesError>> + Send { ... }
fn find_node_with_options(
&mut self,
locator: Locator,
options: FindNodesOptions,
) -> impl Future<Output = Result<Option<Self::BrowserNode>, FindNodesError>> + Send { ... }
fn wait_for_nodes(
&mut self,
locator: Locator,
) -> impl Future<Output = Result<Vec<Self::BrowserNode>, FindNodesError>> + Send { ... }
fn wait_for_nodes_with_options(
&mut self,
locator: Locator,
options: WaitForNodesOptions,
) -> impl Future<Output = Result<Vec<Self::BrowserNode>, FindNodesError>> + Send { ... }
fn wait_for_node(
&mut self,
locator: Locator,
) -> impl Future<Output = Result<Option<Self::BrowserNode>, FindNodesError>> + Send { ... }
fn wait_for_node_with_options(
&mut self,
locator: Locator,
options: WaitForNodesOptions,
) -> impl Future<Output = Result<Option<Self::BrowserNode>, FindNodesError>> + Send { ... }
fn on_request<F, Fut>(
&mut self,
handler: F,
) -> impl Future<Output = Result<(), InterceptNetworkError>> + Send
where F: Fn(NetworkRequest<Self::Transport>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = ()> + Send + 'static { ... }
fn on_request_with_options<F, Fut>(
&mut self,
handler: F,
options: OnRequestOptions,
) -> impl Future<Output = Result<(), InterceptNetworkError>> + Send
where F: Fn(NetworkRequest<Self::Transport>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = ()> + Send + 'static { ... }
fn subscribe_events<F, R>(
&mut self,
events: HashSet<&str>,
handler: F,
) -> impl Future<Output = Result<Option<SubscribeResult>, CommandResultError>> + Send
where F: FnMut(Event) -> R + Send + Sync + 'static,
R: Future<Output = ()> + Send + 'static { ... }
fn subscribe_events_with_options<F, R>(
&mut self,
events: HashSet<&str>,
handler: F,
options: SubscribeEventsOptions,
) -> impl Future<Output = Result<Option<SubscribeResult>, CommandResultError>> + Send
where F: FnMut(Event) -> R + Send + Sync + 'static,
R: Future<Output = ()> + Send + 'static { ... }
fn add_event_handler<F, R>(
&mut self,
events: HashSet<&str>,
handler: F,
) -> impl Future<Output = String> + Send
where F: FnMut(Event) -> R + Send + Sync + 'static,
R: Future<Output = ()> + Send + 'static { ... }
fn evaluate_script(
&mut self,
expression: String,
await_promise: bool,
) -> impl Future<Output = Result<EvaluateResultSuccess, EvaluateResultError>> + Send { ... }
fn evaluate_script_with_options(
&mut self,
expression: String,
await_promise: bool,
options: EvaluateScriptOptions,
) -> impl Future<Output = Result<EvaluateResultSuccess, EvaluateResultError>> + Send { ... }
fn add_preload_script(
&mut self,
function_declaration: String,
) -> impl Future<Output = Result<String, EvaluateResultError>> + Send { ... }
fn add_preload_script_with_options(
&mut self,
function_declaration: String,
options: AddPreloadScriptOptions,
) -> impl Future<Output = Result<String, EvaluateResultError>> + Send { ... }
fn remove_preload_script(
&mut self,
script: String,
) -> impl Future<Output = Result<(), EvaluateResultError>> + Send { ... }
fn screenshot(
&mut self,
) -> impl Future<Output = Result<String, ScreenshotError>> + Send { ... }
fn screenshot_with_options(
&mut self,
options: BrowserScreenshotOptions,
) -> impl Future<Output = Result<String, ScreenshotError>> + Send { ... }
fn emulate_timezone(
&mut self,
timezone: Option<String>,
) -> impl Future<Output = Result<(), EmulationError>> + Send { ... }
fn emulate_timezone_with_options(
&mut self,
timezone: Option<String>,
options: EmulateTimezoneOptions,
) -> impl Future<Output = Result<(), EmulationError>> + Send { ... }
fn authenticate(
&mut self,
username: impl Into<String> + Send + 'static,
password: impl Into<String> + Send + 'static,
) -> impl Future<Output = Result<(), InterceptNetworkError>> + Send { ... }
fn authenticate_with_options(
&mut self,
username: impl Into<String> + Send + 'static,
password: impl Into<String> + Send + 'static,
options: AuthenticateOptions,
) -> impl Future<Output = Result<(), InterceptNetworkError>> + Send { ... }
fn mouse(&self) -> &BidiMouse<Self::Transport> { ... }
fn human_mouse(&self) -> &HumanMouse<BidiMouse<Self::Transport>> { ... }
fn keyboard(&self) -> &BidiKeyboard<Self::Transport> { ... }
fn touchscreen(&self) -> &Touchscreen<Self::Transport> { ... }
fn human_touchscreen(&self) -> &HumanTouchscreen<Self::Transport> { ... }
fn get_active_context_id(
&self,
) -> Result<BrowsingContext, ContextIndexError> { ... }
fn send_command(
&mut self,
command: Command,
) -> impl Future<Output = Result<CommandResponse, SessionSendError>> + Send { ... }
fn end_session(
&mut self,
) -> impl Future<Output = Result<(), SessionSendError>> + Send { ... }
}Required Associated Types§
type Transport: ConnectionTransport + Send + Sync + 'static
type BrowserNode: Node + Send
Required Methods§
Sourcefn driver(&self) -> &BidiDriver<Self::Transport>
fn driver(&self) -> &BidiDriver<Self::Transport>
Access the underlying BiDi driver (immutable).
Sourcefn driver_mut(&mut self) -> &mut BidiDriver<Self::Transport>
fn driver_mut(&mut self) -> &mut BidiDriver<Self::Transport>
Access the underlying BiDi driver (mutable).
Sourcefn build_node(
&self,
raw_node: NodeRemoteValue,
locator: Locator,
context: BrowsingContext,
) -> Self::BrowserNode
fn build_node( &self, raw_node: NodeRemoteValue, locator: Locator, context: BrowsingContext, ) -> Self::BrowserNode
Construct a browser-specific node from raw BiDi data.
Provided Methods§
Navigates to the specified URL in the active context.
Navigates to the specified URL with custom options (wait state, context).
Sourcefn close_context(
&mut self,
context: DomainBrowsingContext,
) -> impl Future<Output = Result<(), ContextCloseError>> + Send
fn close_context( &mut self, context: DomainBrowsingContext, ) -> impl Future<Output = Result<(), ContextCloseError>> + Send
Closes a browsing context (tab/window).
Sourcefn create_context(
&mut self,
background: bool,
) -> impl Future<Output = Result<DomainBrowsingContext, ContextCreationError>> + Send
fn create_context( &mut self, background: bool, ) -> impl Future<Output = Result<DomainBrowsingContext, ContextCreationError>> + Send
Creates a new browsing context (tab) with default options.
Sourcefn create_context_with_options(
&mut self,
background: bool,
options: CreateContextOptions,
) -> impl Future<Output = Result<DomainBrowsingContext, ContextCreationError>> + Send
fn create_context_with_options( &mut self, background: bool, options: CreateContextOptions, ) -> impl Future<Output = Result<DomainBrowsingContext, ContextCreationError>> + Send
Creates a new browsing context with custom options (type, reference context, background).
Sourcefn find_nodes(
&mut self,
locator: Locator,
) -> impl Future<Output = Result<Vec<Self::BrowserNode>, FindNodesError>> + Send
fn find_nodes( &mut self, locator: Locator, ) -> impl Future<Output = Result<Vec<Self::BrowserNode>, FindNodesError>> + Send
Finds all elements matching the given locator in the active context.
Sourcefn find_nodes_with_options(
&mut self,
locator: Locator,
options: FindNodesOptions,
) -> impl Future<Output = Result<Vec<Self::BrowserNode>, FindNodesError>> + Send
fn find_nodes_with_options( &mut self, locator: Locator, options: FindNodesOptions, ) -> impl Future<Output = Result<Vec<Self::BrowserNode>, FindNodesError>> + Send
Finds all elements matching the given locator with custom options (context, count, serialization, start nodes).
Sourcefn find_node(
&mut self,
locator: Locator,
) -> impl Future<Output = Result<Option<Self::BrowserNode>, FindNodesError>> + Send
fn find_node( &mut self, locator: Locator, ) -> impl Future<Output = Result<Option<Self::BrowserNode>, FindNodesError>> + Send
Finds the first element matching the given locator in the active context.
Returns None if no matching element is found.
Sourcefn find_node_with_options(
&mut self,
locator: Locator,
options: FindNodesOptions,
) -> impl Future<Output = Result<Option<Self::BrowserNode>, FindNodesError>> + Send
fn find_node_with_options( &mut self, locator: Locator, options: FindNodesOptions, ) -> impl Future<Output = Result<Option<Self::BrowserNode>, FindNodesError>> + Send
Finds the first element matching the given locator with custom options.
Returns None if no matching element is found.
Sourcefn wait_for_nodes(
&mut self,
locator: Locator,
) -> impl Future<Output = Result<Vec<Self::BrowserNode>, FindNodesError>> + Send
fn wait_for_nodes( &mut self, locator: Locator, ) -> impl Future<Output = Result<Vec<Self::BrowserNode>, FindNodesError>> + Send
Waits for elements matching the locator to appear (default 4s timeout).
Sourcefn wait_for_nodes_with_options(
&mut self,
locator: Locator,
options: WaitForNodesOptions,
) -> impl Future<Output = Result<Vec<Self::BrowserNode>, FindNodesError>> + Send
fn wait_for_nodes_with_options( &mut self, locator: Locator, options: WaitForNodesOptions, ) -> impl Future<Output = Result<Vec<Self::BrowserNode>, FindNodesError>> + Send
Waits for elements matching the locator with custom options (context, timeout, poll interval).
Sourcefn wait_for_node(
&mut self,
locator: Locator,
) -> impl Future<Output = Result<Option<Self::BrowserNode>, FindNodesError>> + Send
fn wait_for_node( &mut self, locator: Locator, ) -> impl Future<Output = Result<Option<Self::BrowserNode>, FindNodesError>> + Send
Waits for a single element matching the locator to appear (default 4s timeout).
Returns None if no matching element appears within the timeout.
Sourcefn wait_for_node_with_options(
&mut self,
locator: Locator,
options: WaitForNodesOptions,
) -> impl Future<Output = Result<Option<Self::BrowserNode>, FindNodesError>> + Send
fn wait_for_node_with_options( &mut self, locator: Locator, options: WaitForNodesOptions, ) -> impl Future<Output = Result<Option<Self::BrowserNode>, FindNodesError>> + Send
Waits for a single element matching the locator with custom options.
Returns None if no matching element appears within the timeout.
Sourcefn on_request<F, Fut>(
&mut self,
handler: F,
) -> impl Future<Output = Result<(), InterceptNetworkError>> + Send
fn on_request<F, Fut>( &mut self, handler: F, ) -> impl Future<Output = Result<(), InterceptNetworkError>> + Send
Registers a handler called for each network request (all URLs, all contexts).
Sourcefn on_request_with_options<F, Fut>(
&mut self,
handler: F,
options: OnRequestOptions,
) -> impl Future<Output = Result<(), InterceptNetworkError>> + Send
fn on_request_with_options<F, Fut>( &mut self, handler: F, options: OnRequestOptions, ) -> impl Future<Output = Result<(), InterceptNetworkError>> + Send
Registers a handler called for each network request with custom URL pattern and context filters.
Sourcefn subscribe_events<F, R>(
&mut self,
events: HashSet<&str>,
handler: F,
) -> impl Future<Output = Result<Option<SubscribeResult>, CommandResultError>> + Send
fn subscribe_events<F, R>( &mut self, events: HashSet<&str>, handler: F, ) -> impl Future<Output = Result<Option<SubscribeResult>, CommandResultError>> + Send
Subscribes to browser events and registers a handler.
Sourcefn subscribe_events_with_options<F, R>(
&mut self,
events: HashSet<&str>,
handler: F,
options: SubscribeEventsOptions,
) -> impl Future<Output = Result<Option<SubscribeResult>, CommandResultError>> + Send
fn subscribe_events_with_options<F, R>( &mut self, events: HashSet<&str>, handler: F, options: SubscribeEventsOptions, ) -> impl Future<Output = Result<Option<SubscribeResult>, CommandResultError>> + Send
Subscribes to browser events with context and user context filters.
Sourcefn add_event_handler<F, R>(
&mut self,
events: HashSet<&str>,
handler: F,
) -> impl Future<Output = String> + Send
fn add_event_handler<F, R>( &mut self, events: HashSet<&str>, handler: F, ) -> impl Future<Output = String> + Send
Adds an event handler without sending a subscription command.
Returns the auto-generated handler ID.
Sourcefn evaluate_script(
&mut self,
expression: String,
await_promise: bool,
) -> impl Future<Output = Result<EvaluateResultSuccess, EvaluateResultError>> + Send
fn evaluate_script( &mut self, expression: String, await_promise: bool, ) -> impl Future<Output = Result<EvaluateResultSuccess, EvaluateResultError>> + Send
Evaluates a JavaScript expression in the active browsing context.
Sourcefn evaluate_script_with_options(
&mut self,
expression: String,
await_promise: bool,
options: EvaluateScriptOptions,
) -> impl Future<Output = Result<EvaluateResultSuccess, EvaluateResultError>> + Send
fn evaluate_script_with_options( &mut self, expression: String, await_promise: bool, options: EvaluateScriptOptions, ) -> impl Future<Output = Result<EvaluateResultSuccess, EvaluateResultError>> + Send
Evaluates a JavaScript expression with custom options (target, result ownership, serialization).
Sourcefn add_preload_script(
&mut self,
function_declaration: String,
) -> impl Future<Output = Result<String, EvaluateResultError>> + Send
fn add_preload_script( &mut self, function_declaration: String, ) -> impl Future<Output = Result<String, EvaluateResultError>> + Send
Adds a preload script that runs in every new browsing context.
Sourcefn add_preload_script_with_options(
&mut self,
function_declaration: String,
options: AddPreloadScriptOptions,
) -> impl Future<Output = Result<String, EvaluateResultError>> + Send
fn add_preload_script_with_options( &mut self, function_declaration: String, options: AddPreloadScriptOptions, ) -> impl Future<Output = Result<String, EvaluateResultError>> + Send
Adds a preload script with custom options (arguments, contexts, sandbox).
Sourcefn remove_preload_script(
&mut self,
script: String,
) -> impl Future<Output = Result<(), EvaluateResultError>> + Send
fn remove_preload_script( &mut self, script: String, ) -> impl Future<Output = Result<(), EvaluateResultError>> + Send
Removes a preload script by its ID.
Sourcefn screenshot(
&mut self,
) -> impl Future<Output = Result<String, ScreenshotError>> + Send
fn screenshot( &mut self, ) -> impl Future<Output = Result<String, ScreenshotError>> + Send
Captures a screenshot of the active browsing context and returns base64-encoded image data.
Sourcefn screenshot_with_options(
&mut self,
options: BrowserScreenshotOptions,
) -> impl Future<Output = Result<String, ScreenshotError>> + Send
fn screenshot_with_options( &mut self, options: BrowserScreenshotOptions, ) -> impl Future<Output = Result<String, ScreenshotError>> + Send
Captures a screenshot with custom options (context, origin, format, clip, save path).
If save_path is a directory, saves with auto-generated filename (screenshot_TIMESTAMP.png).
If save_path is a file path, saves to that exact location and returns the path.
If save_path is None, returns base64-encoded image data.
Sourcefn emulate_timezone(
&mut self,
timezone: Option<String>,
) -> impl Future<Output = Result<(), EmulationError>> + Send
fn emulate_timezone( &mut self, timezone: Option<String>, ) -> impl Future<Output = Result<(), EmulationError>> + Send
Emulates a timezone for the active browsing context.
Pass None to clear the override.
Sourcefn emulate_timezone_with_options(
&mut self,
timezone: Option<String>,
options: EmulateTimezoneOptions,
) -> impl Future<Output = Result<(), EmulationError>> + Send
fn emulate_timezone_with_options( &mut self, timezone: Option<String>, options: EmulateTimezoneOptions, ) -> impl Future<Output = Result<(), EmulationError>> + Send
Emulates a timezone with custom context and user context filters.
Pass None for timezone to clear the override.
Sourcefn authenticate(
&mut self,
username: impl Into<String> + Send + 'static,
password: impl Into<String> + Send + 'static,
) -> impl Future<Output = Result<(), InterceptNetworkError>> + Send
fn authenticate( &mut self, username: impl Into<String> + Send + 'static, password: impl Into<String> + Send + 'static, ) -> impl Future<Output = Result<(), InterceptNetworkError>> + Send
Sets HTTP authentication credentials for all requests.
Sourcefn authenticate_with_options(
&mut self,
username: impl Into<String> + Send + 'static,
password: impl Into<String> + Send + 'static,
options: AuthenticateOptions,
) -> impl Future<Output = Result<(), InterceptNetworkError>> + Send
fn authenticate_with_options( &mut self, username: impl Into<String> + Send + 'static, password: impl Into<String> + Send + 'static, options: AuthenticateOptions, ) -> impl Future<Output = Result<(), InterceptNetworkError>> + Send
Sets HTTP authentication credentials with URL pattern and context filters.
Sourcefn mouse(&self) -> &BidiMouse<Self::Transport>
fn mouse(&self) -> &BidiMouse<Self::Transport>
Returns a reference to the direct BiDi mouse for precise, instant movements.
§Examples
let mouse = browser.mouse();
mouse.move_to(Point { x: 100.0, y: 200.0 }, &context, Default::default()).await?;
mouse.click(None, &context, Default::default()).await?;Sourcefn human_mouse(&self) -> &HumanMouse<BidiMouse<Self::Transport>>
fn human_mouse(&self) -> &HumanMouse<BidiMouse<Self::Transport>>
Returns a reference to the human mouse for realistic, human-like movements with Bezier curves and jitter.
§Examples
let human_mouse = browser.human_mouse();
// Moves with natural curve and realistic delays
human_mouse.move_to(Point { x: 300.0, y: 400.0 }, &context, Default::default()).await?;
human_mouse.click(None, &context, Default::default()).await?;Sourcefn keyboard(&self) -> &BidiKeyboard<Self::Transport>
fn keyboard(&self) -> &BidiKeyboard<Self::Transport>
Returns a reference to the keyboard for text input and key presses.
§Examples
let keyboard = browser.keyboard();
keyboard.type_text("Hello, World!", &context, None).await?;
keyboard.press("Enter", &context, None).await?;fn touchscreen(&self) -> &Touchscreen<Self::Transport>
fn human_touchscreen(&self) -> &HumanTouchscreen<Self::Transport>
fn get_active_context_id(&self) -> Result<BrowsingContext, ContextIndexError>
Sourcefn send_command(
&mut self,
command: Command,
) -> impl Future<Output = Result<CommandResponse, SessionSendError>> + Send
fn send_command( &mut self, command: Command, ) -> impl Future<Output = Result<CommandResponse, SessionSendError>> + Send
Sends a raw WebDriver BiDi command.
Sourcefn end_session(
&mut self,
) -> impl Future<Output = Result<(), SessionSendError>> + Send
fn end_session( &mut self, ) -> impl Future<Output = Result<(), SessionSendError>> + Send
Ends the BiDi session and cleans up resources.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".