Skip to main content

Crate camoufox_juggler

Crate camoufox_juggler 

Source
Expand description

§camoufox-juggler

Native Rust client for Firefox’s Juggler automation protocol.

Camoufox embeds the Juggler protocol (the Firefox automation layer Playwright uses). This crate closes the automation loop with zero Playwright dependency:

  • launch_with_juggler prepares the launch (fingerprint, env, prefs) through the camoufox facade and spawns the browser with the Juggler pipe connected (FDs 3/4 on Unix, PW_PIPE_READ/PW_PIPE_WRITE inheritable handles on Windows)
  • JugglerBrowser manages contexts, pages, cookies, downloads and the credentials-aware proxy configuration
  • JugglerPage navigates, evaluates JS, screenshots, captures cookies/local storage, dispatches input events (mouse, keyboard, touch, wheel), exposes network events, intercepts requests and file choosers, injects WebSocket frames, streams screencasts and tracks web workers
  • verify_fingerprint asserts the running browser’s spoofed surfaces match the generated fingerprint
  • Orchestrator runs a pool of persona-driven browser sessions with rotation policies and persistent rotation state

§Example

use camoufox::builder::{HeadlessMode, LaunchOptions};
use camoufox_core::os::SupportedOs;

let options = LaunchOptions {
    os: vec![SupportedOs::Linux],
    headless: HeadlessMode::On,
    ..Default::default()
};
let mut browser = camoufox_juggler::launch_with_juggler(&options).await?;
let page = browser.new_page().await?;
page.goto("https://example.com").await?;
let title = page.evaluate("document.title").await?;
println!("title: {title:?}");
browser.close().await?;

§Network events & interception

// Observe traffic
let mut events = page.network_events();
page.set_request_interception(true).await?;
while let Some(event) = events.next().await? {
    if let camoufox_juggler::NetworkEvent::RequestWillBeSent(request) = event {
        if request.is_intercepted && request.url.contains("ads.example") {
            page.take_intercepted_request(&request).abort().await?;
        }
    }
}

Re-exports§

pub use binding::BindingCall;
pub use binding::BindingCalls;
pub use browser::JugglerBrowser;
pub use cloudflare::ChallengeKind;
pub use cloudflare::CloudflareOptions;
pub use cloudflare::CloudflareOutcome;
pub use connection::Connection;
pub use connection::DEFAULT_COMMAND_TIMEOUT;
pub use console::ConsoleEvents;
pub use console::ConsoleLevel;
pub use console::ConsoleMessage;
pub use dom::NodeDescription;
pub use dom::Point;
pub use dom::Quad;
pub use download::DownloadBehavior;
pub use download::DownloadCreated;
pub use download::DownloadEvent;
pub use download::DownloadEvents;
pub use download::DownloadFinished;
pub use driver::core_error;
pub use driver::into_core;
pub use driver::launch_with_juggler;
pub use emulation::ColorScheme;
pub use emulation::Contrast;
pub use emulation::EmulatedMedia;
pub use emulation::ForcedColors;
pub use emulation::MediaType;
pub use emulation::ReducedMotion;
pub use error::JugglerError;
pub use error::Result;
pub use har::HarLog;
pub use input::KeyDescriptor;
pub use input::Modifiers;
pub use input::MouseButton;
pub use input::TouchEventType;
pub use input::TouchPoint;
pub use network::FulfillResponse;
pub use network::InterceptedRequest;
pub use network::NetworkEvent;
pub use network::NetworkEvents;
pub use network::NetworkRequest;
pub use network::NetworkRequestFailed;
pub use network::NetworkRequestFinished;
pub use network::NetworkResponseInfo;
pub use network::RouteOverrides;
pub use network::WebSocketFrame;
pub use network::WebSocketInfo;
pub use orchestrator::OrchestratedSession;
pub use orchestrator::Orchestrator;
pub use orchestrator::OrchestratorOptions;
pub use page::Dialog;
pub use page::FileChooser;
pub use page::JugglerPage;
pub use permission::Permission;
pub use screencast::ScreencastFrame;
pub use screencast::ScreencastFrames;
pub use verify::verify_fingerprint;
pub use verify::SurfaceCheck;
pub use verify::VerificationReport;
pub use worker::WorkerEvent;
pub use worker::WorkerEvents;
pub use worker::WorkerInfo;

Modules§

binding
Page bindings: Rust-callable functions exposed into the page.
browser
Browser session: enable, contexts, pages, proxy, cookies, shutdown.
cloudflare
Cloudflare challenge detection and solving (interstitial + Turnstile).
connection
Connection: request/response correlation and event fan-out.
console
Console message capture: Runtime.console events with typed levels.
dom
DOM helpers: element geometry, node description and adoption.
download
Download management: observe, configure and cancel downloads.
driver
Launching Camoufox with the native Juggler driver.
emulation
Emulation: touch capability and emulated media.
error
Error type for the Juggler driver.
har
HAR (HTTP Archive) 1.2 export from captured network events.
input
Input dispatch: mouse, keyboard, touch and wheel events.
network
Network events and request interception.
orchestrator
Multi-browser orchestration: persona pools with rotation state.
page
Page sessions: navigation, evaluation, screenshots, dialogs.
permission
Context permissions: geolocation, notifications, network access.
process
Cross-platform browser child process handle.
protocol
Wire protocol types (JSON messages over the NUL-delimited pipe).
screencast
Screencast streaming: JPEG frames of the page viewport.
transport
Pipe transport: spawns the browser with the Juggler pipe wired up.
verify
Fingerprint injection verification.
worker
Worker lifecycle and messaging.