[−][src]Struct thirtyfour::GenericWebDriver
NOTE: For WebDriver method documentation, see the WebDriverCommands trait.
The thirtyfour
crate uses a generic struct that implements the
WebDriverCommands
trait. The generic struct is then implemented for
a specific HTTP client. This enables thirtyfour
to support different
HTTP clients in order to target different async runtimes. If you do not
require a specific async runtime or if you are using tokio then the
default will work fine.
The GenericWebDriver
struct encapsulates an async Selenium WebDriver browser
session. For the sync driver, see
sync::GenericWebDriver.
Example:
use thirtyfour::prelude::*; use thirtyfour::support::block_on; fn main() -> WebDriverResult<()> { block_on(async { let caps = DesiredCapabilities::chrome(); let driver = WebDriver::new("http://localhost:4444/wd/hub", &caps).await?; driver.get("http://webappdemo").await?; Ok(()) }) }
Fields
session_id: SessionId
Implementations
impl<T: 'static> GenericWebDriver<T> where
T: RemoteConnectionAsync + RemoteConnectionAsyncCreate,
[src]
T: RemoteConnectionAsync + RemoteConnectionAsyncCreate,
pub async fn new<'_, C>(
remote_server_addr: &'_ str,
capabilities: C
) -> WebDriverResult<Self> where
C: Serialize,
[src]
remote_server_addr: &'_ str,
capabilities: C
) -> WebDriverResult<Self> where
C: Serialize,
The GenericWebDriver struct is not intended to be created directly.
Instead you would use the WebDriver struct, which wires up the GenericWebDriver with a HTTP client for making requests to the WebDriver server.
Create a new WebDriver as follows:
Example
let caps = DesiredCapabilities::chrome(); let driver = WebDriver::new("http://localhost:4444/wd/hub", &caps).await?;
pub fn capabilities(&self) -> DesiredCapabilities
[src]
Return a clone of the capabilities as returned by Selenium.
pub async fn quit(__arg0: Self) -> WebDriverResult<()>
[src]
End the webdriver session.
Trait Implementations
impl<T: Debug + RemoteConnectionAsync + RemoteConnectionAsyncCreate> Debug for GenericWebDriver<T>
[src]
impl<T> Drop for GenericWebDriver<T> where
T: RemoteConnectionAsync + RemoteConnectionAsyncCreate,
[src]
T: RemoteConnectionAsync + RemoteConnectionAsyncCreate,
impl<T> WebDriverCommands for GenericWebDriver<T> where
T: RemoteConnectionAsync + RemoteConnectionAsyncCreate,
[src]
T: RemoteConnectionAsync + RemoteConnectionAsyncCreate,
fn cmd<'life0, 'life1, 'async_trait>(
&'life0 self,
command: Command<'life1>
) -> Pin<Box<dyn Future<Output = WebDriverResult<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
[src]
&'life0 self,
command: Command<'life1>
) -> Pin<Box<dyn Future<Output = WebDriverResult<Value>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn session(&self) -> WebDriverSession
[src]
#[must_use]fn close<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn get<'life0, 'async_trait, S: Into<String> + Send>(
&'life0 self,
url: S
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
S: 'async_trait,
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self,
url: S
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
S: 'async_trait,
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn current_url<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn page_source<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn title<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn find_element<'b, 'async_trait>(
&'b self,
by: By<'b>
) -> Pin<Box<dyn Future<Output = WebDriverResult<WebElement<'b>>> + Send + 'async_trait>> where
'b: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'b self,
by: By<'b>
) -> Pin<Box<dyn Future<Output = WebDriverResult<WebElement<'b>>> + Send + 'async_trait>> where
'b: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn find_elements<'b, 'async_trait>(
&'b self,
by: By<'b>
) -> Pin<Box<dyn Future<Output = WebDriverResult<Vec<WebElement<'b>>>> + Send + 'async_trait>> where
'b: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'b self,
by: By<'b>
) -> Pin<Box<dyn Future<Output = WebDriverResult<Vec<WebElement<'b>>>> + Send + 'async_trait>> where
'b: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn execute_script<'b, 'async_trait>(
&'b self,
script: &'b str
) -> Pin<Box<dyn Future<Output = WebDriverResult<ScriptRet<'b>>> + Send + 'async_trait>> where
'b: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'b self,
script: &'b str
) -> Pin<Box<dyn Future<Output = WebDriverResult<ScriptRet<'b>>> + Send + 'async_trait>> where
'b: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn execute_script_with_args<'b, 'async_trait>(
&'b self,
script: &'b str,
args: &'b ScriptArgs
) -> Pin<Box<dyn Future<Output = WebDriverResult<ScriptRet<'b>>> + Send + 'async_trait>> where
'b: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'b self,
script: &'b str,
args: &'b ScriptArgs
) -> Pin<Box<dyn Future<Output = WebDriverResult<ScriptRet<'b>>> + Send + 'async_trait>> where
'b: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn execute_async_script<'b, 'async_trait>(
&'b self,
script: &'b str
) -> Pin<Box<dyn Future<Output = WebDriverResult<ScriptRet<'b>>> + Send + 'async_trait>> where
'b: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'b self,
script: &'b str
) -> Pin<Box<dyn Future<Output = WebDriverResult<ScriptRet<'b>>> + Send + 'async_trait>> where
'b: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn execute_async_script_with_args<'b, 'async_trait>(
&'b self,
script: &'b str,
args: &'b ScriptArgs
) -> Pin<Box<dyn Future<Output = WebDriverResult<ScriptRet<'b>>> + Send + 'async_trait>> where
'b: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'b self,
script: &'b str,
args: &'b ScriptArgs
) -> Pin<Box<dyn Future<Output = WebDriverResult<ScriptRet<'b>>> + Send + 'async_trait>> where
'b: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn current_window_handle<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<WindowHandle>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<WindowHandle>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn window_handles<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<Vec<WindowHandle>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<Vec<WindowHandle>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn maximize_window<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn minimize_window<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn fullscreen_window<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn get_window_rect<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<Rect>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<Rect>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn set_window_rect<'life0, 'async_trait>(
&'life0 self,
rect: OptionRect
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self,
rect: OptionRect
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn back<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn forward<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn refresh<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn get_timeouts<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<TimeoutConfiguration>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<TimeoutConfiguration>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn set_timeouts<'life0, 'async_trait>(
&'life0 self,
timeouts: TimeoutConfiguration
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self,
timeouts: TimeoutConfiguration
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn implicitly_wait<'life0, 'async_trait>(
&'life0 self,
time_to_wait: Duration
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self,
time_to_wait: Duration
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn set_script_timeout<'life0, 'async_trait>(
&'life0 self,
time_to_wait: Duration
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self,
time_to_wait: Duration
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn set_page_load_timeout<'life0, 'async_trait>(
&'life0 self,
time_to_wait: Duration
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self,
time_to_wait: Duration
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn action_chain(&self) -> ActionChain
[src]
#[must_use]fn get_cookies<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<Vec<Cookie>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<Vec<Cookie>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn get_cookie<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str
) -> Pin<Box<dyn Future<Output = WebDriverResult<Cookie>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self,
name: &'life1 str
) -> Pin<Box<dyn Future<Output = WebDriverResult<Cookie>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn delete_cookie<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self,
name: &'life1 str
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn delete_all_cookies<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn add_cookie<'life0, 'async_trait>(
&'life0 self,
cookie: Cookie
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self,
cookie: Cookie
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn screenshot_as_base64<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<String>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn screenshot_as_png<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self
) -> Pin<Box<dyn Future<Output = WebDriverResult<Vec<u8>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: Sync + 'async_trait,
#[must_use]fn screenshot<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 Path
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self,
path: &'life1 Path
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
fn switch_to(&self) -> SwitchTo
[src]
#[must_use]fn set_window_name<'life0, 'life1, 'async_trait>(
&'life0 self,
window_name: &'life1 str
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
[src]
&'life0 self,
window_name: &'life1 str
) -> Pin<Box<dyn Future<Output = WebDriverResult<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: Sync + 'async_trait,
Auto Trait Implementations
impl<T> !RefUnwindSafe for GenericWebDriver<T>
impl<T> Send for GenericWebDriver<T>
impl<T> Sync for GenericWebDriver<T>
impl<T> Unpin for GenericWebDriver<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for GenericWebDriver<T>
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,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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.
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>,