Skip to main content

FirefoxBrowser

Struct FirefoxBrowser 

Source
pub struct FirefoxBrowser { /* private fields */ }

Implementations§

Source§

impl FirefoxBrowser

Source

pub async fn new(config: FirefoxConfig) -> FirefoxBrowser

Source

pub async fn connect_bidi(&mut self)

Source

pub fn get_config(&self) -> &FirefoxConfig

Source

pub fn get_browser_process(&self) -> &Option<Process>

Trait Implementations§

Source§

impl BidiBrowser for FirefoxBrowser

Source§

type Transport = WebsocketConnectionTransport

Source§

type BrowserNode = FirefoxNode<WebsocketConnectionTransport>

Source§

fn driver(&self) -> &BidiDriver<WebsocketConnectionTransport>

Access the underlying BiDi driver (immutable).
Source§

fn driver_mut(&mut self) -> &mut BidiDriver<WebsocketConnectionTransport>

Access the underlying BiDi driver (mutable).
Source§

fn build_node( &self, raw_node: NodeRemoteValue, locator: Locator, context: BrowsingContext, ) -> FirefoxNode<WebsocketConnectionTransport>

Construct a browser-specific node from raw BiDi data.
Source§

async fn close(self) -> Result<(), BrowserCloseError>

Closes the browser: ends the BiDi session, closes the WebSocket connection, and performs any browser-specific cleanup (e.g. kills the browser process).
Source§

fn navigate( &mut self, url: &str, ) -> impl Future<Output = Result<NavigateResult, NavigateError>> + Send

Navigates to the specified URL in the active context.
Source§

fn navigate_with_options( &mut self, url: &str, options: NavigateOptions, ) -> impl Future<Output = Result<NavigateResult, NavigateError>> + Send

Navigates to the specified URL with custom options (wait state, context).
Source§

fn close_context( &mut self, context: DomainBrowsingContext, ) -> impl Future<Output = Result<(), ContextCloseError>> + Send

Closes a browsing context (tab/window).
Source§

fn create_context( &mut self, background: bool, ) -> impl Future<Output = Result<DomainBrowsingContext, ContextCreationError>> + Send

Creates a new browsing context (tab) with default options.
Source§

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).
Source§

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.
Source§

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).
Source§

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. Read more
Source§

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. Read more
Source§

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).
Source§

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).
Source§

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). Read more
Source§

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. Read more
Source§

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,

Registers a handler called for each network request (all URLs, all contexts).
Source§

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,

Registers a handler called for each network request with custom URL pattern and context filters.
Source§

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,

Subscribes to browser events and registers a handler.
Source§

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,

Subscribes to browser events with context and user context filters.
Source§

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,

Adds an event handler without sending a subscription command. Read more
Source§

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.
Source§

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).
Source§

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.
Source§

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).
Source§

fn remove_preload_script( &mut self, script: String, ) -> impl Future<Output = Result<(), EvaluateResultError>> + Send

Removes a preload script by its ID.
Source§

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.
Source§

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). Read more
Source§

fn emulate_timezone( &mut self, timezone: Option<String>, ) -> impl Future<Output = Result<(), EmulationError>> + Send

Emulates a timezone for the active browsing context. Read more
Source§

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. Read more
Source§

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.
Source§

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.
Source§

fn mouse(&self) -> &BidiMouse<Self::Transport>

Returns a reference to the direct BiDi mouse for precise, instant movements. Read more
Source§

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. Read more
Source§

fn keyboard(&self) -> &BidiKeyboard<Self::Transport>

Returns a reference to the keyboard for text input and key presses. Read more
Source§

fn touchscreen(&self) -> &Touchscreen<Self::Transport>

Source§

fn human_touchscreen(&self) -> &HumanTouchscreen<Self::Transport>

Source§

fn get_active_context_id(&self) -> Result<BrowsingContext, ContextIndexError>

Source§

fn send_command( &mut self, command: Command, ) -> impl Future<Output = Result<CommandResponse, SessionSendError>> + Send

Sends a raw WebDriver BiDi command.
Source§

fn end_session( &mut self, ) -> impl Future<Output = Result<(), SessionSendError>> + Send

Ends the BiDi session and cleans up resources.
Source§

impl Debug for FirefoxBrowser

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more