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<()> {
// Start the installed browser the way a person would, with a fresh
// temporary profile, and attach the engine to it.
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?);
// Stops the browser and deletes the temporary profile.
result.close().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)puppeteer- Typed Puppeteer API over the JavaScript CLI’s bridgetraces- Recording, reading and exporting privacy-aware portable trace bundlesutilities- General utilities (URL handling, wait operations)high_level- High-level DRY utilities
Re-exports§
pub use browser::extension_relay::attach_via_extension;pub use browser::extension_relay::write_extension_directory;pub use browser::extension_relay::ExtensionRelay;pub use browser::extension_relay::RelayError;pub use browser::extension_relay::RelayEvent;pub use browser::extension_relay::RelayExtension;pub use browser::extension_relay::RelayOptions;pub use browser::extension_relay::RelaySession;pub use browser::extension_relay::RelayTab;pub use browser::parity;pub use browser::webdriver::launch_webdriver;pub use browser::webdriver::launch_webdriver_snapshot;pub use browser::webdriver::ManagedWebDriver;pub use browser::webdriver::WebDriverBrowser;pub use browser::webdriver::WebDriverOptions;pub use browser::webdriver::WebDriverSnapshotResult;pub use parity::measure_parity;pub use parity::measure_session_parity;pub use parity::MeasureParityOptions;pub use parity::ParityReport;pub use browser::snapshot::launch_snapshot;pub use browser::snapshot::snapshot_user_data_dir;pub use browser::snapshot::SnapshotLaunchResult;pub use browser::snapshot::SnapshotOptions;pub use browser::snapshot::SnapshotReport;pub use browser::browser_family;pub use browser::browser_for_identifier;pub use browser::browser_ids;pub use browser::browser_sources;pub use browser::build_real_browser_args;pub use browser::connect_browser;pub use browser::default_browser_identifiers;pub use browser::default_run_command;pub use browser::emulate_media;pub use browser::find_browser_source;pub use browser::is_default_browser_keyword;pub use browser::is_single_profile_browser;pub use browser::launch_and_connect_real_browser;pub use browser::launch_browser;pub use browser::launch_real_browser;pub use browser::launch_restrictions;pub use browser::list_browser_profiles;pub use browser::normalize_browser_id;pub use browser::parse_mac_launch_services_handler;pub use browser::parse_windows_prog_id;pub use browser::resolve_browser_roots;pub use browser::resolve_default_browser;pub use browser::resolve_import_source;pub use browser::resolve_restrictions;pub use browser::resolve_source_browser;pub use browser::safe_storage_identity;pub use browser::save_storage_state;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::BrowserSource;pub use browser::ChromiumoxidePage;pub use browser::ColorScheme;pub use browser::ConnectOptions;pub use browser::CookieSourceListing;pub use browser::EmulateMediaOptions;pub use browser::Environment;pub use browser::ImportSource;pub use browser::LaunchMode;pub use browser::LaunchOptions;pub use browser::LaunchRestriction;pub use browser::LaunchResult;pub use browser::NodeBridgePage;pub use browser::PlaywrightConnect;pub use browser::PlaywrightDriverPage;pub use browser::PlaywrightLaunch;pub use browser::RealBrowserLaunchResult;pub use browser::RealBrowserOptions;pub use browser::RunCommand;pub use browser::SafeStorageIdentity;pub use browser::StorageEntry;pub use browser::StorageOrigin;pub use browser::StorageState;pub use browser::StorageStateInput;pub use browser::LAUNCH_MODES;pub use browser::SUPPORTED_COOKIE_BROWSERS;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;pub use traces::start_trace;pub use traces::trace_links;pub use traces::write_trace_links;pub use traces::write_trace_viewer;pub use traces::AdapterTracePage;pub use traces::TraceCheckpointOptions;pub use traces::TraceLinksOptions;pub use traces::TraceOptions;pub use traces::TraceRecordError;pub use traces::TraceRecorder;pub use traces::TraceResult;pub use traces::TraceStopOptions;
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.
- playwright
- Native Playwright client over the official driver.
- prelude
- Prelude module for convenient imports.
- puppeteer
- Puppeteer from Rust, typed, over the JavaScript CLI’s generic bridge (issue #108).
- traces
- Privacy-aware portable traces (issue #87).
- utilities
- Utilities for browser automation.
Structs§
- WebDriver
Client - A WebDriver client tied to a single browser session.