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 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(
explicit_profile_dir: Option<&Path>,
cdp_port: u16,
) -> Option<Self>
pub async fn find_existing( explicit_profile_dir: Option<&Path>, cdp_port: u16, ) -> Option<Self>
Find existing browser by TCP probing and discovering WS URL.
Sourcepub async fn discover_ws_url(
explicit_profile_dir: Option<&Path>,
cdp_port: u16,
) -> Option<String>
pub async fn discover_ws_url( explicit_profile_dir: Option<&Path>, cdp_port: u16, ) -> Option<String>
Discover WS URL by searching for DevToolsActivePort in common profile paths.
Sourcepub fn probe_port(cdp_port: u16) -> bool
pub fn probe_port(cdp_port: u16) -> bool
Probe port to see if it’s accepting connections. Tries IPv4 first, then IPv6.
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