fantoccini::wd

Trait WebDriverCompatibleCommand

Source
pub trait WebDriverCompatibleCommand: Debug {
    // Required methods
    fn endpoint(
        &self,
        base_url: &Url,
        session_id: Option<&str>,
    ) -> Result<Url, ParseError>;
    fn method_and_body(&self, request_url: &Url) -> (Method, Option<String>);

    // Provided methods
    fn is_new_session(&self) -> bool { ... }
    fn is_legacy(&self) -> bool { ... }
}
Expand description

A command that can be sent to the WebDriver.

Anything that implements this command can be sent to Client::issue_cmd() in order to send custom commands to the WebDriver instance.

Required Methods§

Source

fn endpoint( &self, base_url: &Url, session_id: Option<&str>, ) -> Result<Url, ParseError>

The endpoint to send the request to.

Source

fn method_and_body(&self, request_url: &Url) -> (Method, Option<String>)

The HTTP request method to use, and the request body for the request.

The url will be the one returned from the endpoint() method above.

Provided Methods§

Source

fn is_new_session(&self) -> bool

Return true if this command starts a new WebDriver session.

Source

fn is_legacy(&self) -> bool

Return true if this session should only support the legacy webdriver protocol.

This only applies to the obsolete JSON Wire Protocol and should return false for all implementations that follow the W3C specification.

See https://www.selenium.dev/documentation/legacy/json_wire_protocol/ for more details about JSON Wire Protocol.

Implementations on Foreign Types§

Source§

impl WebDriverCompatibleCommand for WebDriverCommand<VoidWebDriverExtensionCommand>

Source§

fn endpoint( &self, base_url: &Url, session_id: Option<&str>, ) -> Result<Url, ParseError>

Helper for determining what URL endpoint to use for various requests.

This mapping is essentially that of https://www.w3.org/TR/webdriver/#list-of-endpoints.

Source§

fn method_and_body(&self, request_url: &Url) -> (Method, Option<String>)

Source§

fn is_new_session(&self) -> bool

Source§

fn is_legacy(&self) -> bool

Source§

impl<T> WebDriverCompatibleCommand for &T

Blanket implementation for &T, for better ergonomics.

Source§

fn endpoint( &self, base_url: &Url, session_id: Option<&str>, ) -> Result<Url, ParseError>

Source§

fn method_and_body(&self, request_url: &Url) -> (Method, Option<String>)

Source§

fn is_new_session(&self) -> bool

Source§

fn is_legacy(&self) -> bool

Source§

impl<T> WebDriverCompatibleCommand for Box<T>

Blanket implementation for Box, for better ergonomics.

Source§

fn endpoint( &self, base_url: &Url, session_id: Option<&str>, ) -> Result<Url, ParseError>

Source§

fn method_and_body(&self, request_url: &Url) -> (Method, Option<String>)

Source§

fn is_new_session(&self) -> bool

Source§

fn is_legacy(&self) -> bool

Implementors§