[−][src]Struct fantoccini::Element
A single element on the current page.
Implementations
impl Element
[src]
pub async fn attr(
&mut self,
attribute: &str
) -> Result<Option<String>, CmdError>
[src]
&mut self,
attribute: &str
) -> Result<Option<String>, CmdError>
Look up an attribute value for this element by name.
Ok(None)
is returned if the element does not have the given attribute.
pub async fn prop(&mut self, prop: &str) -> Result<Option<String>, CmdError>
[src]
Look up a DOM property for this element by name.
Ok(None)
is returned if the element does not have the given property.
pub async fn text(&mut self) -> Result<String, CmdError>
[src]
Retrieve the text contents of this elment.
pub async fn html(&mut self, inner: bool) -> Result<String, CmdError>
[src]
Retrieve the HTML contents of this element.
inner
dictates whether the wrapping node's HTML is excluded or not. For example, take the
HTML:
<div id="foo"><hr /></div>
With inner = true
, <hr />
would be returned. With inner = false
,
<div id="foo"><hr /></div>
would be returned instead.
pub async fn find(&mut self, search: Locator<'_>) -> Result<Element, CmdError>
[src]
Find the first matching descendant element.
pub async fn find_all(
&mut self,
search: Locator<'_>
) -> Result<Vec<Element>, CmdError>
[src]
&mut self,
search: Locator<'_>
) -> Result<Vec<Element>, CmdError>
Find all matching descendant elements.
pub async fn click(self) -> Result<Client, CmdError>
[src]
Simulate the user clicking on this element.
Note that since this may result in navigation, we give up the handle to the element.
pub async fn clear(&mut self) -> Result<(), CmdError>
[src]
Clear the value prop of this element
pub async fn send_keys(&mut self, text: &str) -> Result<(), CmdError>
[src]
Simulate the user sending keys to an element.
pub fn client(self) -> Client
[src]
Get back the Client
hosting this Element
.
pub async fn follow(self) -> Result<Client, CmdError>
[src]
Follow the href
target of the element matching the given CSS selector without causing a
click interaction.
Note that since this may result in navigation, we give up the handle to the element.
pub async fn select_by_value(self, value: &str) -> Result<Client, CmdError>
[src]
Find and click an option
child element by its value
attribute.
pub async fn select_by_index(self, index: usize) -> Result<Client, CmdError>
[src]
Find and click an <option>
child element by its index.
This method clicks the first <option>
element that is an index
th child
(option:nth-of-type(index+1)
). This will be the index
th <option>
element if the current element is a <select>
. If you use this method on
an Element
that is not a <select>
(such as on a full <form>
), it
may not do what you expect if there are multiple <select>
elements
in the form, or if it there are stray <option>
in the form.
The indexing in this method is 0-based.
pub async fn select_by_label(self, label: &str) -> Result<Client, CmdError>
[src]
Find and click an <option>
element by its visible text.
The method doesn't make any escaping for the argument like it is done in python webdriver client for example. It also doesn't make any normalizations before match.
pub async fn enter_frame(self) -> Result<Client, CmdError>
[src]
Switches to the frame contained within the element.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Element
[src]
impl Send for Element
[src]
impl Sync for Element
[src]
impl Unpin for Element
[src]
impl !UnwindSafe for Element
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,