Skip to main content

launch_firefox_self_managed

Function launch_firefox_self_managed 

Source
pub async fn launch_firefox_self_managed(
    config: FoxBrowserConfig,
) -> Result<Page>
Expand description

Launch Firefox where foxdriver owns the spawn and the readiness wait, then attaches over BiDi in rustenium Remote mode.

The default launch_firefox delegates spawning to rustenium, which sleeps a fixed 500 ms after exec before connecting to the BiDi WebSocket. That races any build whose remote agent binds slowly, a freshly-built Camoufox/reynard takes ~1 s, yielding a ConnectionRefused panic. Here foxdriver spawns the process, polls the debugging port until it actually accepts a connection (Law-7: readiness, never a fixed sleep), and only then hands rustenium an already-live port via FirefoxLaunchMode::Remote. The spawned std::process::Child is owned by the returned Page and killed on close/drop.

config.executable_path is resolved via [resolve_firefox_binary], the explicit path if set, else PATH / standard install locations (this path never auto-downloads Firefox).