Struct Tab

Source
pub struct Tab { /* private fields */ }
Expand description

Tabs are used to load a site and get informations.

 
let mut session = Session::new(Browser::Firefox, false).unwrap();
 
// using the default tab
session.tabs[0].navigate("https://www.mozilla.org/fr/").unwrap();

Implementations§

Source§

impl Tab

Source

pub fn new_from(id: String, session_id: Rc<String>) -> Tab

Source

pub fn get_session_id(&self) -> Rc<String>

Source

pub fn new(session: &mut Session) -> Result<&Tab, WebdriverError>

Create a new tab in a session. This return an immutable reference (in a Result) because the tab is stored in the session.

Source

pub fn select(&self) -> Result<(), WebdriverError>

Select this tab. Selection is done automatically by this crate when you get informations.

Source

pub fn navigate(&mut self, url: &str) -> Result<(), WebdriverError>

Load a website

Source

pub fn find( &mut self, selector: Selector, tofind: &str, ) -> Result<Option<Element>, WebdriverError>

Find an element in the tab, selected by a Selector.

Source

pub fn get_url(&self) -> Result<String, WebdriverError>

Return the url of the current web page.

Source

pub fn get_title(&self) -> Result<String, WebdriverError>

Return the title of the tab.

Source

pub fn back(&mut self) -> Result<(), WebdriverError>

Navigate to the previous page.

Source

pub fn forward(&mut self) -> Result<(), WebdriverError>

Navigate forward.

Source

pub fn refresh(&mut self) -> Result<(), WebdriverError>

Refresh the page.

Source

pub fn execute_script( &self, script: &str, args: Vec<JsonValue>, ) -> Result<(), WebdriverError>

Source

pub fn get_cookies( &self, ) -> Result<Vec<(String, usize, bool, String, String, bool, String)>, WebdriverError>

Source

pub fn set_cookies( &self, cookies: Vec<(String, usize, bool, String, String, bool, String)>, ) -> Result<(), WebdriverError>

Source

pub fn get_page_source(&self) -> Result<String, WebdriverError>

Trait Implementations§

Source§

impl Drop for Tab

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl PartialEq for Tab

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl WebdriverObject for Tab

Source§

fn get_id(&self) -> &String

Auto Trait Implementations§

§

impl Freeze for Tab

§

impl RefUnwindSafe for Tab

§

impl !Send for Tab

§

impl !Sync for Tab

§

impl Unpin for Tab

§

impl UnwindSafe for Tab

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.