[][src]Struct selenium_webdriver::Element

pub struct Element { /* fields omitted */ }

WebElement

Provides methods to interact with page elements.

Implementations

impl Element[src]

pub fn find_element_from_self(
    &self,
    locator: LocatorStrategy
) -> Result<Element, String>
[src]

Returns the first child element which is found using the locator.

pub fn find_elements_from_self(
    &self,
    locator: LocatorStrategy
) -> Result<Vec<Element>, String>
[src]

Returns all children elements which are found using the locator.

pub fn is_selected(&self) -> Result<bool, String>[src]

pub fn get_attribute(&self, attribute_name: &str) -> Result<String, String>[src]

pub fn get_property(&self, property_name: &str) -> Result<String, String>[src]

Due to the large number of structure variants that may be returned by this function, parsing the String response to the necessary type is left for the lib users

pub fn get_css_value(&self, css_property_name: &str) -> Result<String, String>[src]

The logic behind returning json is the same as for get_property method

pub fn get_element_text(&self) -> Result<String, String>[src]

pub fn get_tag_name(&self) -> Result<String, String>[src]

pub fn get_element_rect(&self) -> Result<ElementRect, String>[src]

Returns the element's size(hight,width) and position(x-axis and y-axis)

pub fn is_enabled(&self) -> Result<bool, String>[src]

pub fn get_computed_role(&self) -> Result<String, String>[src]

As of 06.11.2020 computed role and computed label are not implemented by chrome and geckodrivers, so this method will only be returning errors for now

pub fn get_computed_label(&self) -> Result<String, String>[src]

See above

pub fn click(&self) -> Result<(), String>[src]

pub fn clear_element(&self) -> Result<(), String>[src]

Clears any element text

pub fn send_keys(&self, message: &str) -> Result<(), String>[src]

Sends the text to the element if it is possibe for the element, otherwise, returns error

Examples

let mut br = Browser::start_session(BrowserName::Chrome,  vec!["--headless","--window-size=400,200"]);
br.open("https://vk.com").unwrap();
let el= br.find_element(LocatorStrategy::CSS("#ts_input")).unwrap();
el.send_keys("Sup!").unwrap();
br.close_browser().unwrap();

Trait Implementations

impl Debug for Element[src]

Auto Trait Implementations

impl RefUnwindSafe for Element

impl Send for Element

impl Sync for Element

impl Unpin for Element

impl UnwindSafe for Element

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.