pub struct Element<'a> { /* private fields */ }
Expand description
An HTML element within a WebDriver session.
Implementations§
Source§impl<'a> Element<'a>
impl<'a> Element<'a>
pub fn new(s: &'a DriverSession, reference: String) -> Self
pub fn attribute(&self, name: &str) -> Result<String, Error>
Sourcepub fn property(&self, name: &str) -> Result<String, Error>
pub fn property(&self, name: &str) -> Result<String, Error>
Return this element’s property value.
WebDriver spec: https://www.w3.org/TR/webdriver/#get-element-property
Sourcepub fn click(&self) -> Result<(), Error>
pub fn click(&self) -> Result<(), Error>
Click this element.
WebDriver spec: https://www.w3.org/TR/webdriver/#element-click
Sourcepub fn clear(&self) -> Result<(), Error>
pub fn clear(&self) -> Result<(), Error>
Clear the text of this element.
WebDriver spec: https://www.w3.org/TR/webdriver/#element-clear
Sourcepub fn send_keys(&self, s: &str) -> Result<(), Error>
pub fn send_keys(&self, s: &str) -> Result<(), Error>
Send key presses to this element.
WebDriver spec: https://www.w3.org/TR/webdriver/#element-send-keys
pub fn css_value(&self, name: &str) -> Result<String, Error>
pub fn text(&self) -> Result<String, Error>
pub fn find_element( &self, selector: &str, strategy: LocationStrategy, ) -> Result<Element<'_>, Error>
pub fn find_elements( &self, selector: &str, strategy: LocationStrategy, ) -> Result<Vec<Element<'_>>, Error>
Sourcepub fn reference(&self) -> Result<JsonValue, Error>
pub fn reference(&self) -> Result<JsonValue, Error>
Returns a reference that can be passed on to the API
Sourcepub fn raw_reference(&self) -> &str
pub fn raw_reference(&self) -> &str
The raw reference id that identifies this element, this can be used with Element::new()
Sourcepub fn inner_html(&self) -> Result<JsonValue, Error>
pub fn inner_html(&self) -> Result<JsonValue, Error>
Gets the innerHTML
javascript attribute for this element. Some drivers can get
this using regular attributes, in others it does not work. This method gets it
executing a bit of javascript.
pub fn outer_html(&self) -> Result<JsonValue, Error>
Sourcepub fn screenshot(&self) -> Result<Screenshot, Error>
pub fn screenshot(&self) -> Result<Screenshot, Error>
Take a screenshot of this element
WebDriver specification: https://www.w3.org/TR/webdriver/#take-element-screenshot