pub struct ElementSelector {
pub css_selector: String,
pub xpath: Option<String>,
pub tag_name: String,
pub id: Option<String>,
pub text: Option<String>,
}Expand description
Information needed to locate an element
Fields§
§css_selector: StringCSS selector for the element
xpath: Option<String>XPath selector (alternative to CSS)
tag_name: StringElement’s tag name
id: Option<String>Element’s ID attribute (if any)
text: Option<String>Element’s text content (truncated for display)
Implementations§
Source§impl ElementSelector
impl ElementSelector
Sourcepub fn new(css_selector: impl Into<String>, tag_name: impl Into<String>) -> Self
pub fn new(css_selector: impl Into<String>, tag_name: impl Into<String>) -> Self
Create a new ElementSelector with CSS selector
Sourcepub fn with_xpath(self, xpath: impl Into<String>) -> Self
pub fn with_xpath(self, xpath: impl Into<String>) -> Self
Builder method: set XPath
Sourcepub fn best_selector(&self) -> &str
pub fn best_selector(&self) -> &str
Get the best selector to use (CSS preferred)
Trait Implementations§
Source§impl Clone for ElementSelector
impl Clone for ElementSelector
Source§fn clone(&self) -> ElementSelector
fn clone(&self) -> ElementSelector
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ElementSelector
impl Debug for ElementSelector
Source§impl<'de> Deserialize<'de> for ElementSelector
impl<'de> Deserialize<'de> for ElementSelector
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ElementSelector
impl PartialEq for ElementSelector
Source§impl Serialize for ElementSelector
impl Serialize for ElementSelector
impl StructuralPartialEq for ElementSelector
Auto Trait Implementations§
impl Freeze for ElementSelector
impl RefUnwindSafe for ElementSelector
impl Send for ElementSelector
impl Sync for ElementSelector
impl Unpin for ElementSelector
impl UnwindSafe for ElementSelector
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more