Skip to main content

build_text_selector

Function build_text_selector 

Source
pub fn build_text_selector(text: &str, element_type: Option<&str>) -> String
Expand description

Build a CSS selector to find elements by visible text.

This creates a selector that matches elements containing the specified text. Note: This is a best-effort approach and may not work for all cases.

§Arguments

  • text - The text to search for
  • element_type - Optional element type to restrict the search (e.g., “button”)

§Returns

A CSS selector string (or XPath for more complex cases)