Skip to main content

detect

Function detect 

Source
pub async fn detect(port: u16) -> Result<DetectedBrowser>
Expand description

Multi-strategy browser detection.

Tries each strategy in order and returns the first successful result:

  1. GTHINGS_CDP_WS_URL environment variable (fastest bypass).
  2. HTTP GET http://127.0.0.1:{port}/json/version — parses webSocketDebuggerUrl.
  3. HTTP GET http://127.0.0.1:{port}/json — finds first webSocketDebuggerUrl.
  4. HTTP GET http://127.0.0.1:{port}/json/list — finds first webSocketDebuggerUrl.
  5. DevToolsActivePort scan across 10+ browser profile directories on macOS.

Returns CdpError::BrowserNotFound if all strategies fail.