or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

browser-management.mdbrowser-managers.mdcli-interface.mdconfiguration.mddriver-management.mdindex.md
tile.json

browser-management.mddocs/

Browser Management

Selenium Manager provides comprehensive browser management capabilities including automatic browser discovery, version detection, and browser downloading when needed.

Browser Discovery and Version Detection

Browser Version Discovery

Automatically discovers the version of browsers installed on the system.

trait SeleniumManager {
    fn discover_browser_version(&mut self) -> Result<Option<String>, Error>;
}

Parameters: None Returns: Result<Option<String>, Error> - The discovered browser version or None if not found Description: Scans the system to detect the installed browser version

Browser Path Detection

Detects the path to browser executables on the system.

trait SeleniumManager {
    fn detect_browser_path(&mut self) -> Option<PathBuf>;
}

Parameters: None Returns: Option<PathBuf> - Path to the browser executable or None if not found Description: Locates browser executable in standard installation paths

Browser Names in PATH

Gets a list of browser names found in the system PATH.

trait SeleniumManager {
    fn get_browser_names_in_path(&self) -> Vec<&str>;
}

Parameters: None Returns: Vec<&str> - List of browser executable names found in PATH Description: Searches PATH environment variable for browser executables

Browser Path Mapping

Creates a mapping of browser names to their executable paths.

trait SeleniumManager {
    fn get_browser_path_map(&self) -> HashMap<BrowserPath, &str>;
}

Parameters: None Returns: HashMap<BrowserPath, &str> - Mapping of browser types to paths Description: Creates a comprehensive map of available browsers and their locations

Browser Downloading

Download Browser

Downloads and installs a specific version of a browser.

trait SeleniumManager {
    fn download_browser(&mut self, browser_version: &str) -> Result<Option<PathBuf>, Error>;
}

Parameters:

  • browser_version: &str - The specific browser version to download

Returns: Result<Option<PathBuf>, Error> - Path to the downloaded browser or None if not needed Description: Downloads the specified browser version and returns the installation path

Browser Information

Get Browser Name

Returns the name of the browser managed by this manager.

trait SeleniumManager {
    fn get_browser_name(&self) -> &str;
}

Parameters: None Returns: &str - The browser name (e.g., "chrome", "firefox", "edge") Description: Gets the canonical name of the browser this manager handles

Usage Examples

Basic Browser Discovery

use selenium_manager::{get_manager_by_browser, SeleniumManager};
use anyhow::Result;

fn discover_browser() -> Result<()> {
    let mut manager = get_manager_by_browser("chrome".to_string())?;
    
    // Discover installed browser version
    if let Some(version) = manager.discover_browser_version()? {
        println!("Found Chrome version: {}", version);
    } else {
        println!("Chrome not found on system");
    }
    
    // Detect browser path
    if let Some(path) = manager.detect_browser_path() {
        println!("Chrome located at: {}", path.display());
    }
    
    Ok(())
}

Download Browser When Missing

use selenium_manager::{get_manager_by_browser, SeleniumManager};
use anyhow::Result;

fn ensure_browser_available() -> Result<()> {
    let mut manager = get_manager_by_browser("firefox".to_string())?;
    
    // Check if browser is available
    if manager.discover_browser_version()?.is_none() {
        println!("Firefox not found, downloading latest version...");
        
        // Download latest stable version
        if let Some(download_path) = manager.download_browser("stable")? {
            println!("Firefox downloaded to: {}", download_path.display());
        }
    }
    
    Ok(())
}

Browser Path Discovery

use selenium_manager::{get_manager_by_browser, SeleniumManager};
use anyhow::Result;

fn map_available_browsers() -> Result<()> {
    let manager = get_manager_by_browser("chrome".to_string())?;
    
    // Get all browsers in PATH
    let browsers_in_path = manager.get_browser_names_in_path();
    println!("Browsers in PATH: {:?}", browsers_in_path);
    
    // Get detailed path mapping
    let browser_paths = manager.get_browser_path_map();
    for (browser_type, path) in browser_paths {
        println!("{:?}: {}", browser_type, path);
    }
    
    Ok(())
}

Browser Version Channels

Selenium Manager supports different browser release channels:

  • stable: Production release version
  • beta: Beta testing version
  • dev: Development version
  • canary: Nightly development builds (Chrome only)
  • nightly: Nightly development builds (Firefox only)
  • esr: Extended Support Release (Firefox only)

Platform-Specific Behavior

Windows

  • Searches standard installation paths in Program Files
  • Supports both x64 and ARM64 architectures
  • Registry-based browser discovery

macOS

  • Searches Applications folder and standard paths
  • Supports both Intel and Apple Silicon (ARM64)
  • Bundle-based application discovery

Linux

  • Searches standard binary paths (/usr/bin, /usr/local/bin, etc.)
  • Supports x64 and ARM64 architectures
  • Package manager integration awareness

Error Handling

Browser management operations return Result<T, Error> types. Common error scenarios:

  • BrowserNotFound: Browser executable not found on system
  • VersionDetectionFailed: Unable to determine browser version
  • DownloadFailed: Network or permission issues during browser download
  • UnsupportedPlatform: Browser not available for current platform
  • InvalidVersion: Requested browser version does not exist