pub struct Browser { /* private fields */ }Expand description
A persistent Chrome browser instance. Stays alive after Drop.
Implementations§
Source§impl Browser
impl Browser
Sourcepub async fn launch(
browser_path: Option<PathBuf>,
profile_dir: Option<PathBuf>,
cdp_port: u16,
) -> Result<Self>
pub async fn launch( browser_path: Option<PathBuf>, profile_dir: Option<PathBuf>, cdp_port: u16, ) -> Result<Self>
Launch or reuse a persistent Chrome browser.
Sourcepub async fn connect(&self) -> Result<Connection>
pub async fn connect(&self) -> Result<Connection>
Connect to CDP WebSocket.
Sourcepub async fn pid(&self) -> u64
pub async fn pid(&self) -> u64
Get the process ID (always 0; PID tracking was removed in stateless rewrite).
Sourcepub fn is_alive(cdp_port: u16) -> bool
pub fn is_alive(cdp_port: u16) -> bool
Check if the browser is alive by probing the given port.
Sourcepub async fn find_existing(profile_dir: &Path, cdp_port: u16) -> Option<Self>
pub async fn find_existing(profile_dir: &Path, cdp_port: u16) -> Option<Self>
Find existing browser by reading DevToolsActivePort and verifying WS.
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 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