pub struct Browser { /* private fields */ }Expand description
A browser automation session.
Implementations§
Source§impl Browser
impl Browser
Sourcepub async fn launch(options: LaunchOptions) -> Result<Browser, AutomationError>
pub async fn launch(options: LaunchOptions) -> Result<Browser, AutomationError>
Launch a new browser using the supplied options.
Sourcepub async fn connect_websocket(
url: impl AsRef<str>,
) -> Result<Browser, AutomationError>
pub async fn connect_websocket( url: impl AsRef<str>, ) -> Result<Browser, AutomationError>
Connect to an already-running Chrome DevTools websocket endpoint.
Sourcepub fn cdp(&self) -> CdpSession
pub fn cdp(&self) -> CdpSession
Returns a raw CDP escape hatch rooted at the browser session.
Sourcepub async fn new_page(&self) -> Result<Page, AutomationError>
pub async fn new_page(&self) -> Result<Page, AutomationError>
Open a new page and bootstrap the common CDP domains used by Playhard.
Sourcepub fn network_events(&self) -> EventStream
pub fn network_events(&self) -> EventStream
Subscribe to all browser-wide network and fetch events.
Sourcepub async fn enable_request_interception(
&self,
patterns: Vec<RequestPattern>,
) -> Result<(), AutomationError>
pub async fn enable_request_interception( &self, patterns: Vec<RequestPattern>, ) -> Result<(), AutomationError>
Enable request interception for all existing and future pages.
Sourcepub async fn next_route(
&self,
timeout_duration: Duration,
) -> Result<Route, AutomationError>
pub async fn next_route( &self, timeout_duration: Duration, ) -> Result<Route, AutomationError>
Wait for the next paused request across all pages.
Sourcepub async fn shutdown(self) -> Result<(), AutomationError>
pub async fn shutdown(self) -> Result<(), AutomationError>
Shut down the browser and close the underlying transport.
Auto Trait Implementations§
impl Freeze for Browser
impl !RefUnwindSafe for Browser
impl Send for Browser
impl Sync for Browser
impl Unpin for Browser
impl UnsafeUnpin 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
Mutably borrows from an owned value. Read more