Module browser

Module browser 

Source
Expand description

Browser entities: Window, Tab, Element.

This module contains the core types for browser automation:

  • Window - Browser window (owns Firefox process)
  • Tab - Browser tab with frame context
  • Element - DOM element reference Browser entities module.

This module provides the core browser automation types:

TypeDescription
WindowBrowser window (owns Firefox process, references shared pool)
TabBrowser tab (frame context)
ElementDOM element reference
KeyKeyboard key constants
ByElement locator strategies

§Example

use firefox_webdriver::{Driver, Result, Key, By};

let driver = Driver::builder()
    .binary("/usr/bin/firefox")
    .extension("./extension")
    .build()
    .await?;

let window = driver.window().headless().spawn().await?;
let tab = window.tab();

tab.goto("https://example.com").await?;

// Find with By selector
let element = tab.find_element(By::tag("h1")).await?;

// Find by text
let btn = tab.find_element(By::text("Submit")).await?;

// Press keys
element.press(Key::Enter).await?;

Re-exports§

pub use element::Element;
pub use keyboard::Key;
pub use network::BodyAction;
pub use network::HeadersAction;
pub use network::InterceptedRequest;
pub use network::InterceptedRequestBody;
pub use network::InterceptedRequestHeaders;
pub use network::InterceptedResponse;
pub use network::InterceptedResponseBody;
pub use network::RequestAction;
pub use network::RequestBody;
pub use network::ResponseAction;
pub use proxy::ProxyConfig;
pub use proxy::ProxyType;
pub use selector::By;
pub use tab::FrameInfo;
pub use tab::ImageFormat;
pub use tab::ScreenshotBuilder;
pub use tab::Tab;
pub use window::Window;
pub use window::WindowBuilder;
pub use crate::protocol::Cookie;

Modules§

element
DOM element interaction. DOM element interaction and manipulation.
keyboard
Keyboard key definitions. Keyboard key definitions and utilities.
network
Network interception types. Network interception types.
proxy
Proxy configuration types. Proxy configuration types.
selector
Element locator strategies. Element locator strategies.
tab
Browser tab automation. Browser tab automation and control.
window
Browser window management. Browser window management and control.