Skip to main content

Crate browser_commander

Crate browser_commander 

Source
Expand description

Browser Commander - Universal Browser Automation Library

A Rust library for browser automation that provides a unified API for different browser automation engines.

§Features

  • Unified API across multiple browser engines
  • Built-in navigation safety handling
  • Element visibility and scroll management
  • Click, fill, and other interaction support with verification
  • Async/await support with Tokio

§Example

use browser_commander::browser::{launch_browser, LaunchOptions};

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Launch a browser
    let options = LaunchOptions::chromiumoxide().headless(true);
    let result = launch_browser(options).await?;

    // The returned `page` is an `Arc<dyn EngineAdapter>` and can be
    // passed to any of the crate's navigation / interaction helpers.
    let page = result.page.as_ref();
    page.goto("https://example.com").await?;
    println!("Current URL: {}", page.url().await?);

    Ok(())
}

§Modules

  • core - Core types and traits (constants, engine adapter, logger)
  • elements - Element operations (selectors, visibility, content)
  • interactions - User interactions (click, scroll, fill)
  • browser - Browser management (launcher, navigation)
  • downloads - Managed, persistent downloads (manager, store, sources)
  • fingerprint - Fingerprint parity with a hand-started browser (profiles, presets, automation parity)
  • traces - Reading privacy-aware portable trace bundles
  • utilities - General utilities (URL handling, wait operations)
  • high_level - High-level DRY utilities

Re-exports§

pub use browser::build_real_browser_args;
pub use browser::connect_browser;
pub use browser::emulate_media;
pub use browser::launch_and_connect_real_browser;
pub use browser::launch_browser;
pub use browser::launch_real_browser;
pub use browser::list_browser_profiles;
pub use browser::read_browser_cookies;
pub use browser::Browser;
pub use browser::BrowserCookie;
pub use browser::BrowserCookieReadOptions;
pub use browser::BrowserProcess;
pub use browser::BrowserProfile;
pub use browser::BrowserProfileOptions;
pub use browser::ChromiumoxidePage;
pub use browser::ColorScheme;
pub use browser::ConnectOptions;
pub use browser::EmulateMediaOptions;
pub use browser::LaunchOptions;
pub use browser::LaunchResult;
pub use browser::NodeBridgePage;
pub use browser::RealBrowserLaunchResult;
pub use browser::RealBrowserOptions;
pub use core::DialogEvent;
pub use core::DialogManager;
pub use core::DialogType;
pub use core::EngineAdapter;
pub use core::EngineError;
pub use core::EngineType;
pub use core::Logger;
pub use core::LoggerOptions;
pub use core::PdfOptions;
pub use core::Timing;
pub use core::CHROME_ARGS;
pub use core::TIMING;
pub use downloads::attach_downloads;
pub use downloads::normalize_download_options;
pub use downloads::supported_engine;
pub use downloads::CaptureOptions;
pub use downloads::DownloadArtifact;
pub use downloads::DownloadConflict;
pub use downloads::DownloadError;
pub use downloads::DownloadEvent;
pub use downloads::DownloadManager;
pub use downloads::DownloadNamer;
pub use downloads::DownloadNaming;
pub use downloads::DownloadOptions;
pub use downloads::DownloadSetting;
pub use downloads::DownloadValidator;
pub use downloads::DEFAULT_CAPTURE_TIMEOUT;
pub use fingerprint::apply_automation_parity_args;
pub use fingerprint::apply_fingerprint;
pub use fingerprint::build_cdp_emulation_commands;
pub use fingerprint::build_fingerprint_init_script;
pub use fingerprint::build_init_script_config;
pub use fingerprint::create_default_fingerprint_preset;
pub use fingerprint::create_fingerprint_preset;
pub use fingerprint::derive_user_agent_data;
pub use fingerprint::detect_automation_controlled_triggers;
pub use fingerprint::disables_automation_controlled;
pub use fingerprint::find_fingerprint_limitation;
pub use fingerprint::fingerprint_field_mechanism;
pub use fingerprint::parity_ignored_default_args;
pub use fingerprint::relevant_fingerprint_limitations;
pub use fingerprint::resolve_fingerprint_profile;
pub use fingerprint::AppliedFingerprint;
pub use fingerprint::ApplyOptions;
pub use fingerprint::AutomationTrigger;
pub use fingerprint::BrandVersion;
pub use fingerprint::CdpCommand;
pub use fingerprint::CdpTransport;
pub use fingerprint::ColorScheme as FingerprintColorScheme;
pub use fingerprint::DetectedTrigger;
pub use fingerprint::FieldMechanism;
pub use fingerprint::FingerprintLimitation;
pub use fingerprint::FingerprintProfile;
pub use fingerprint::ForcedColors;
pub use fingerprint::GeolocationProfile;
pub use fingerprint::InitScriptOptions;
pub use fingerprint::LimitationContext;
pub use fingerprint::LimitationEvidence;
pub use fingerprint::LimitationSeverity;
pub use fingerprint::ReducedMotion;
pub use fingerprint::ScreenProfile;
pub use fingerprint::UserAgentData;
pub use fingerprint::ViewportProfile;
pub use fingerprint::WebglProfile;
pub use fingerprint::AUTOMATION_CONTROLLED_OFF_ARG;
pub use fingerprint::AUTOMATION_CONTROLLED_TRIGGERS;
pub use fingerprint::DEFAULT_CHROME_VERSION;
pub use fingerprint::FINGERPRINT_FIELD_MECHANISMS;
pub use fingerprint::FINGERPRINT_LIMITATIONS;
pub use fingerprint::FINGERPRINT_LIMITATIONS_SOURCE;
pub use fingerprint::FINGERPRINT_PAYLOAD_SOURCE;
pub use fingerprint::FINGERPRINT_PRESET_NAMES;
pub use fingerprint::PLAYWRIGHT_HEADLESS_POINTER_ARG;
pub use fingerprint::PLAYWRIGHT_SOFTWARE_WEBGL_ARG;
pub use traces::diff_control_state;
pub use traces::parse_ndjson;
pub use traces::read_trace;
pub use traces::ControlChange;
pub use traces::ControlChangeKind;
pub use traces::ParsedNdjson;
pub use traces::Trace;
pub use traces::TraceCheckpoint;
pub use traces::TraceCheckpointReason;
pub use traces::TraceError;
pub use traces::TraceEvent;
pub use traces::TraceFiles;
pub use traces::TraceLiveState;
pub use traces::TraceManifest;
pub use traces::TraceMode;
pub use traces::TraceMutationKind;
pub use traces::TraceOutcome;
pub use traces::TraceReplaySupport;
pub use traces::TRACE_EVENT_SOURCES;
pub use traces::TRACE_FORMAT;
pub use traces::TRACE_SCHEMA_VERSION;

Modules§

browser
Browser management for browser automation.
core
Core functionality for browser automation.
downloads
Managed, persistent downloads (issue #88).
elements
Element operations for browser automation.
fingerprint
Fingerprint parity between a real Chrome and a controlled one.
high_level
High-level operations for browser automation.
interactions
Interaction operations for browser automation.
prelude
Prelude module for convenient imports.
traces
Privacy-aware portable traces (issue #87).
utilities
Utilities for browser automation.