pub struct BrowserGuard { /* private fields */ }Expand description
Guard that returns browser to pool when dropped
Methods from Deref<Target = Browser>§
Sourcepub fn websocket_address(&self) -> &String
pub fn websocket_address(&self) -> &String
Returns the address of the websocket this browser is attached to
Sourcepub fn is_incognito(&self) -> bool
pub fn is_incognito(&self) -> bool
Whether the BrowserContext is incognito.
Sourcepub fn config(&self) -> Option<&BrowserConfig>
pub fn config(&self) -> Option<&BrowserConfig>
The config of the spawned chromium instance if any.
Sourcepub async fn new_page(
&self,
params: impl Into<CreateTargetParams>,
) -> Result<Page, CdpError>
pub async fn new_page( &self, params: impl Into<CreateTargetParams>, ) -> Result<Page, CdpError>
Create a new browser page
Sourcepub async fn version(&self) -> Result<GetVersionReturns, CdpError>
pub async fn version(&self) -> Result<GetVersionReturns, CdpError>
Version information about the browser
Sourcepub async fn user_agent(&self) -> Result<String, CdpError>
pub async fn user_agent(&self) -> Result<String, CdpError>
Returns the user agent of the browser
Sourcepub async fn execute<T>(
&self,
cmd: T,
) -> Result<CommandResponse<<T as Command>::Response>, CdpError>where
T: Command,
pub async fn execute<T>(
&self,
cmd: T,
) -> Result<CommandResponse<<T as Command>::Response>, CdpError>where
T: Command,
Call a browser method.
Sourcepub async fn pages(&self) -> Result<Vec<Page>, CdpError>
pub async fn pages(&self) -> Result<Vec<Page>, CdpError>
Return all of the pages of the browser
Sourcepub async fn get_page(&self, target_id: TargetId) -> Result<Page, CdpError>
pub async fn get_page(&self, target_id: TargetId) -> Result<Page, CdpError>
Return page of given target_id
Sourcepub async fn event_listener<T>(&self) -> Result<EventStream<T>, CdpError>where
T: IntoEventKind,
pub async fn event_listener<T>(&self) -> Result<EventStream<T>, CdpError>where
T: IntoEventKind,
Set listener for browser event
Sourcepub async fn create_browser_context(
&self,
params: CreateBrowserContextParams,
) -> Result<BrowserContextId, CdpError>
pub async fn create_browser_context( &self, params: CreateBrowserContextParams, ) -> Result<BrowserContextId, CdpError>
Creates a new empty browser context.
Sourcepub async fn dispose_browser_context(
&self,
browser_context_id: impl Into<BrowserContextId>,
) -> Result<(), CdpError>
pub async fn dispose_browser_context( &self, browser_context_id: impl Into<BrowserContextId>, ) -> Result<(), CdpError>
Deletes a browser context.
Clears cookies.
Returns all browser cookies.
Sets given cookies.
Trait Implementations§
Source§impl Deref for BrowserGuard
impl Deref for BrowserGuard
Auto Trait Implementations§
impl Freeze for BrowserGuard
impl !RefUnwindSafe for BrowserGuard
impl Send for BrowserGuard
impl Sync for BrowserGuard
impl Unpin for BrowserGuard
impl UnsafeUnpin for BrowserGuard
impl !UnwindSafe for BrowserGuard
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
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>
Converts
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>
Converts
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