pub struct Browser {
pub workdir: String,
pub client: Client,
pub container_id: String,
/* private fields */
}
Expand description
Stores virtual browser data.
Fields§
§workdir: String
Folder where the screenshots and downloaded files will be stored.
client: Client
WebDriver Client instance.
container_id: String
Chromedriver container identifier.
Implementations§
Source§impl Browser
impl Browser
Sourcepub async fn goto(&mut self, url: &str) -> Result<()>
pub async fn goto(&mut self, url: &str) -> Result<()>
Navigate to the given URL.
§Errors
Returns error if there was a problem while executing WebDriver
command.
Sourcepub async fn get_current_url(&self) -> Result<String>
pub async fn get_current_url(&self) -> Result<String>
Get the current URL.
§Errors
Returns error if there was a problem while executing WebDriver
command.
Sourcepub async fn get_html(&self) -> Result<String>
pub async fn get_html(&self) -> Result<String>
Get the HTML of the current page.
§Errors
Returns error if there was a problem while executing WebDriver
command.
Sourcepub async fn save_screenshot(&self) -> Result<String>
pub async fn save_screenshot(&self) -> Result<String>
Save a screenshot of the current page.
§Errors
Returns error if there was a problem while executing WebDriver
command or saving the screenshot.
Sourcepub async fn list_viewport_elements(&self) -> Result<Vec<Element>>
pub async fn list_viewport_elements(&self) -> Result<Vec<Element>>
Get meaningful elements from the current viewport.
§Errors
Returns error if there was a problem while executing WebDriver
command.
Sourcepub async fn scroll_down(&self) -> Result<()>
pub async fn scroll_down(&self) -> Result<()>
Scrolls one screen down.
§Errors
Returns error if there was a problem while executing WebDriver
command.
Sourcepub async fn scroll_up(&self) -> Result<()>
pub async fn scroll_up(&self) -> Result<()>
Scrolls one screen up.
§Errors
Returns error if there was a problem while executing WebDriver
command.
Sourcepub async fn get_scroll_position(&self) -> Result<i64>
pub async fn get_scroll_position(&self) -> Result<i64>
Calculates scroll position percentage.
§Errors
Returns error if there was a problem while executing WebDriver
command.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Browser
impl RefUnwindSafe for Browser
impl Send for Browser
impl Sync for Browser
impl Unpin for Browser
impl UnwindSafe for Browser
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more