[][src]Struct rusty_driver::Driver

pub struct Driver(_);

Methods

impl Driver[src]

pub async fn new<'_>(
    webdriver_url: &'_ str,
    user_agent: Option<String>
) -> Result<Self>
[src]

Create a new webdriver session on the specified server

pub async fn goto<'a>(&'a self, url: &'a str) -> Result<()>[src]

Navigate directly to the given URL.

pub async fn current_url<'_>(&'_ self) -> Result<Url>[src]

Retrieve the currently active URL for this session.

pub async fn source<'_>(&'_ self) -> Result<String>[src]

Get the HTML source for the current page.

pub async fn back<'_>(&'_ self) -> Result<()>[src]

Go back to the previous page.

pub async fn refresh<'_>(&'_ self) -> Result<()>[src]

Refresh the current previous page.

pub async fn switch_to_frame<'_>(&'_ self, frame: WebElement) -> Result<()>[src]

Switch the focus to the frame contained in Element

pub async fn switch_to_parent_frame<'_>(&'_ self) -> Result<()>[src]

Switch the focus to this frame's parent frame

pub async fn switch_to_window<'_>(&'_ self, window: String) -> Result<()>[src]

Switch the focus to the window identified by handle

pub async fn execute<'_>(
    &'_ self,
    script: String,
    __arg2: Vec<Value>
) -> Result<Value>
[src]

Execute the given JavaScript script in the current browser session.

args is available to the script inside the arguments array. Since Element implements ToJson, you can also provide serialized Elements as arguments, and they will correctly serialize to DOM elements on the other side.

pub async fn wait_for_navigation<'_>(
    &'_ self,
    current: Option<Url>
) -> Result<()>
[src]

Wait for the page to navigate to a new URL before proceeding.

If the current URL is not provided, self.current_url() will be used. Note however that this introduces a race condition: the browser could finish navigating before we call current_url(), which would lead to an eternal wait.

pub async fn find<'_>(
    &'_ self,
    locator: Locator,
    root: Option<WebElement>
) -> Result<WebElement>
[src]

Starting from the document root, find the first element on the page that matches the specified selector.

pub async fn find_all<'_>(
    &'_ self,
    locator: Locator,
    root: Option<WebElement>
) -> Result<Vec<WebElement>>
[src]

pub async fn wait_for_find<'_>(
    &'_ self,
    search: Locator,
    root: Option<WebElement>
) -> Result<WebElement>
[src]

Wait for the specified element(s) to appear on the page

pub async fn wait_for_find_all<'_>(
    &'_ self,
    search: Locator,
    root: Option<WebElement>
) -> Result<Vec<WebElement>>
[src]

Wait for the specified element(s) to appear on the page

pub async fn attr<'_>(
    &'_ self,
    eid: WebElement,
    attribute: String
) -> Result<Option<String>>
[src]

Look up an attribute value for this element by name.

pub async fn prop<'_>(
    &'_ self,
    eid: WebElement,
    prop: String
) -> Result<Option<String>>
[src]

Look up a DOM property for this element by name.

pub async fn text<'_>(&'_ self, eid: WebElement) -> Result<String>[src]

Retrieve the text contents of this elment.

pub async fn html<'_>(&'_ self, eid: WebElement, inner: bool) -> Result<String>[src]

Retrieve the HTML contents of this element. if inner is true, also return the wrapping nodes html. Note: this is the same as calling prop("innerHTML") or prop("outerHTML").

pub async fn click<'_>(&'_ self, eid: WebElement) -> Result<()>[src]

Click on this element

pub async fn scroll_into_view<'_>(&'_ self, eid: WebElement) -> Result<()>[src]

Scroll this element into view

pub async fn follow<'_>(&'_ self, eid: WebElement) -> Result<()>[src]

Follow the href target of the element matching the given CSS selector without causing a click interaction.

pub async fn set_by_name<'_>(
    &'_ self,
    eid: WebElement,
    name: String,
    value: String
) -> Result<()>
[src]

Set the value of the input element named name which is a child of eid

pub async fn submit<'_>(&'_ self, eid: WebElement) -> Result<()>[src]

Submit the form specified by eid with the first submit button

pub async fn submit_with<'_>(
    &'_ self,
    eid: WebElement,
    button: Locator
) -> Result<()>
[src]

Submit the form eid using the button matched by the given selector.

pub async fn submit_using<'_>(
    &'_ self,
    eid: WebElement,
    button_label: String
) -> Result<()>
[src]

Submit this form using the form submit button with the given label (case-insensitive).

pub async fn submit_direct<'_>(&'_ self, eid: WebElement) -> Result<()>[src]

Submit this form directly, without clicking any buttons.

This can be useful to bypass forms that perform various magic when the submit button is clicked, or that hijack click events altogether.

Note that since no button is actually clicked, the name=value pair for the submit button will not be submitted. This can be circumvented by using submit_sneaky instead.

pub async fn submit_sneaky<'_>(
    &'_ self,
    eid: WebElement,
    field: String,
    value: String
) -> Result<()>
[src]

Submit this form directly, without clicking any buttons, and with an extra field.

Like submit_direct, this method will submit this form without clicking a submit button. However, it will also inject a hidden input element on the page that carries the given field=value mapping. This allows you to emulate the form data as it would have been if the submit button was indeed clicked.

Auto Trait Implementations

impl Send for Driver

impl Sync for Driver

impl Unpin for Driver

impl !UnwindSafe for Driver

impl !RefUnwindSafe for Driver

Blanket Implementations

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

impl<T> From<T> for 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.

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

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

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

impl<T> Erased for T

impl<T> Same<T> for T

type Output = T

Should always be Self