Expand description
Element locator strategies. Element locator strategies.
Provides Selenium-like By selectors for finding elements.
§Example
ⓘ
use firefox_webdriver::By;
// CSS selector (default)
let btn = tab.find_element(By::Css("#submit")).await?;
// By ID (shorthand for CSS #id)
let form = tab.find_element(By::Id("login-form")).await?;
// By text content
let link = tab.find_element(By::Text("Click here")).await?;
// By partial text
let link = tab.find_element(By::PartialText("Click")).await?;
// By XPath
let btn = tab.find_element(By::XPath("//button[@type='submit']")).await?;
// By tag name
let inputs = tab.find_elements(By::Tag("input")).await?;Enums§
- By
- Element locator strategy (like Selenium’s
By).