Struct fantoccini::Client[][src]

pub struct Client(_);

A WebDriver client tied to a single browser session.

Methods

impl Client
[src]

Create a new Client associated with a new WebDriver session on the server at the given URL.

Calls with_capabilities with an empty capabilities list.

Create a new Client associated with a new WebDriver session on the server at the given URL.

The given capabilities will be requested in alwaysMatch or desiredCapabilities depending on the protocol version supported by the server.

Returns a future that resolves to a handle for issuing additional WebDriver tasks.

Note that most callers should explicitly call Client::close, and wait for the returned future before exiting. Not doing so may result in the WebDriver session not being cleanly closed, which is particularly important for some drivers, such as geckodriver, where multiple simulatenous sessions are not supported. If close is not explicitly called, a session close request will be spawned on the given handle when the last instance of this Client is dropped.

Get the session ID assigned by the WebDriver server to this client.

Set the User Agent string to use for all subsequent requests.

Terminate the connection to the webservice.

Normally, a shutdown of the WebDriver connection will be initiated when the last clone of a Client is dropped. Specifically, the shutdown request will be issued using the tokio Handle given when creating this Client. This in turn means that any errors will be dropped, and that the teardown may not even occur if the reactor does not continue being turned.

This function is safe to call multiple times, but once it has been called on one instance of a Client, all requests to other instances of that Client will fail. The returned Option will only be true the first time close is called.

This function may be useful in conjunction with raw_client_for, as it allows you to close the automated browser window while doing e.g., a large download.

Sets the x, y, width, and height properties of the current window.

All values must be >= 0 or you will get a CmdError::InvalidArgument.

Gets the x, y, width, and height properties of the current window.

Sets the x, y, width, and height properties of the current window.

All values must be >= 0 or you will get a CmdError::InvalidArgument.

Gets the width and height of the current window.

Sets the x, y, width, and height properties of the current window.

All values must be >= 0 or you will get a CmdError::InvalidArgument.

Gets the x and y top-left coordinate of the current window.

Navigate directly to the given URL.

Retrieve the currently active URL for this session.

Get the HTML source for the current page.

Go back to the previous page.

Refresh the current previous page.

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.

Issue an HTTP request to the given url with all the same cookies as the current session.

Calling this method is equivalent to calling with_raw_client_for with an empty closure.

Build and issue an HTTP request to the given url with all the same cookies as the current session.

Before the HTTP request is issued, the given before closure will be called with a handle to the Request about to be sent.

Find an element on the page.

Important traits for &'a mut R

Wait for the given function to return true before proceeding.

This can be useful to wait for something to appear on the page before interacting with it. While this currently just spins and yields, it may be more efficient than this in the future. In particular, in time, it may only run is_ready again when an event occurs on the page.

Wait for the given element to be present on the page.

This can be useful to wait for something to appear on the page before interacting with it. While this currently just spins and yields, it may be more efficient than this in the future. In particular, in time, it may only run is_ready again when an event occurs on the page.

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.

Locate a form on the page.

Through the returned Form, HTML forms can be filled out and submitted.

Auto Trait Implementations

impl !Send for Client

impl !Sync for Client