pub struct Browser { /* private fields */ }Expand description
Represents a managed or attached browser instance.
Implementations§
Source§impl Browser
impl Browser
Sourcepub async fn ensure(config: BrowserConfig) -> Result<Browser, BrowserError>
pub async fn ensure(config: BrowserConfig) -> Result<Browser, BrowserError>
Ensures a browser is available based on the provided configuration.
Depending on LaunchMode, it will attach, launch a new instance, or try both.
Sourcepub async fn client(&self) -> Result<CdpClient, BrowserError>
pub async fn client(&self) -> Result<CdpClient, BrowserError>
Retrieves a CDP client connected to this browser. Reuses existing client connection if available and alive.
Sourcepub async fn stop(&self) -> Result<(), BrowserError>
pub async fn stop(&self) -> Result<(), BrowserError>
Stops the browser if managed, or simply closes the connection if attached. Also cleans up ephemeral profiles.
Sourcepub async fn restart(&self) -> Result<(), BrowserError>
pub async fn restart(&self) -> Result<(), BrowserError>
Restarts the browser instance using the original configuration.
Sourcepub fn is_managed(&self) -> bool
pub fn is_managed(&self) -> bool
Returns true if this browser was launched (and is managed) by us.
Sourcepub fn debug_address(&self) -> (&str, u16)
pub fn debug_address(&self) -> (&str, u16)
Returns the remote debugging host and port this browser is listening on.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Browser
impl !UnwindSafe for Browser
impl Freeze for Browser
impl Send for Browser
impl Sync for Browser
impl Unpin for Browser
impl UnsafeUnpin 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