pub struct Element { /* private fields */ }Implementations§
Source§impl Element
impl Element
Sourcepub async fn click(&self) -> XcelerateResult<&Self>
pub async fn click(&self) -> XcelerateResult<&Self>
Examples found in repository?
examples/google_search.rs (line 24)
4async fn main() -> XcelerateResult<()> {
5 // 1. Setup magic launching!
6 let (browser, handler) = Browser::launch(
7 BrowserConfig::builder()
8 .headless(false) // Set to true for background running
9 .build()?
10 ).await?;
11
12 // 2. Start the engine
13 tokio::spawn(handler.run());
14
15 // 3. User your clean API
16 println!("Launching Browser and navigating to Google...");
17 let page = browser.new_page("https://www.google.com").await?;
18
19 println!("Typing and Clicking...");
20 page.find_element("input[name='q']")
21 .await?
22 .type_text("Xcelerate Rust Automation")
23 .await?
24 .click()
25 .await?;
26
27 println!("Process finished successfully!");
28 Ok(())
29}Sourcepub async fn type_text(&self, text: &str) -> XcelerateResult<&Self>
pub async fn type_text(&self, text: &str) -> XcelerateResult<&Self>
Examples found in repository?
examples/google_search.rs (line 22)
4async fn main() -> XcelerateResult<()> {
5 // 1. Setup magic launching!
6 let (browser, handler) = Browser::launch(
7 BrowserConfig::builder()
8 .headless(false) // Set to true for background running
9 .build()?
10 ).await?;
11
12 // 2. Start the engine
13 tokio::spawn(handler.run());
14
15 // 3. User your clean API
16 println!("Launching Browser and navigating to Google...");
17 let page = browser.new_page("https://www.google.com").await?;
18
19 println!("Typing and Clicking...");
20 page.find_element("input[name='q']")
21 .await?
22 .type_text("Xcelerate Rust Automation")
23 .await?
24 .click()
25 .await?;
26
27 println!("Process finished successfully!");
28 Ok(())
29}Sourcepub async fn hover(&self) -> XcelerateResult<&Self>
pub async fn hover(&self) -> XcelerateResult<&Self>
Hovers over the element.
Sourcepub async fn focus(&self) -> XcelerateResult<&Self>
pub async fn focus(&self) -> XcelerateResult<&Self>
Focuses the element.
Sourcepub async fn text(&self) -> XcelerateResult<String>
pub async fn text(&self) -> XcelerateResult<String>
Returns the visible text of the element.
Sourcepub async fn attribute(&self, name: &str) -> XcelerateResult<Option<String>>
pub async fn attribute(&self, name: &str) -> XcelerateResult<Option<String>>
Returns the value of a specific attribute.
Sourcepub async fn inner_html(&self) -> XcelerateResult<String>
pub async fn inner_html(&self) -> XcelerateResult<String>
Returns the inner HTML of the element.
Auto Trait Implementations§
impl Freeze for Element
impl !RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnsafeUnpin for Element
impl !UnwindSafe for Element
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