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
impl Tab
pub fn new_from(id: String, session_id: Rc<String>) -> Tab
pub fn get_session_id(&self) -> Rc<String>
Sourcepub fn new(session: &mut Session) -> Result<&Tab, WebdriverError>
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.
Sourcepub fn select(&self) -> Result<(), WebdriverError>
pub fn select(&self) -> Result<(), WebdriverError>
Select this tab. Selection is done automatically by this crate when you get informations.
Load a website
Sourcepub fn find(
&mut self,
selector: Selector,
tofind: &str,
) -> Result<Option<Element>, WebdriverError>
pub fn find( &mut self, selector: Selector, tofind: &str, ) -> Result<Option<Element>, WebdriverError>
Find an element in the tab, selected by a Selector.
Sourcepub fn get_url(&self) -> Result<String, WebdriverError>
pub fn get_url(&self) -> Result<String, WebdriverError>
Return the url of the current web page.
Sourcepub fn get_title(&self) -> Result<String, WebdriverError>
pub fn get_title(&self) -> Result<String, WebdriverError>
Return the title of the tab.
Sourcepub fn back(&mut self) -> Result<(), WebdriverError>
pub fn back(&mut self) -> Result<(), WebdriverError>
Navigate to the previous page.
Sourcepub fn forward(&mut self) -> Result<(), WebdriverError>
pub fn forward(&mut self) -> Result<(), WebdriverError>
Navigate forward.
Sourcepub fn refresh(&mut self) -> Result<(), WebdriverError>
pub fn refresh(&mut self) -> Result<(), WebdriverError>
Refresh the page.
pub fn execute_script( &self, script: &str, args: Vec<JsonValue>, ) -> Result<(), WebdriverError>
pub fn get_page_source(&self) -> Result<String, WebdriverError>
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more