or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

browser-configuration.mdcontext-management.mddriver-management.mdextension-management.mdindex.mdprofile-management.mdscreenshot-capabilities.mdservice-management.md
tile.json

tessl/maven-org-seleniumhq-selenium--selenium-firefox-driver

Selenium Firefox WebDriver implementation for automating Firefox browser interactions

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.seleniumhq.selenium/selenium-firefox-driver@4.33.x

To install, run

npx @tessl/cli install tessl/maven-org-seleniumhq-selenium--selenium-firefox-driver@4.33.0

index.mddocs/

Selenium Firefox WebDriver

The Selenium Firefox WebDriver provides comprehensive automation capabilities for Mozilla Firefox browsers. This library offers a complete WebDriver implementation with Firefox-specific features including profile management, extension handling, full-page screenshots, and modern WebDriver BiDi protocol support.

Package Information

  • Package Name: selenium-firefox-driver
  • Package Type: maven
  • Language: Java
  • Maven Coordinates: org.seleniumhq.selenium:selenium-firefox-driver:4.33.0
  • Installation: Add to Maven dependencies:
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-firefox-driver</artifactId>
    <version>4.33.0</version>
</dependency>

Core Imports

import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.GeckoDriverService;

Basic Usage

import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxOptions;
import org.openqa.selenium.WebDriver;

// Basic Firefox driver creation
WebDriver driver = new FirefoxDriver();

// Firefox driver with options
FirefoxOptions options = new FirefoxOptions()
    .addPreference("browser.startup.page", 1)
    .addPreference("browser.startup.homepage", "https://example.com")
    .setAcceptInsecureCerts(true)
    .setHeadless(true);

WebDriver driver = new FirefoxDriver(options);

// Navigate and interact
driver.get("https://example.com");
String title = driver.getTitle();

// Clean up
driver.quit();

Architecture

The Firefox WebDriver is built around several key components:

  • FirefoxDriver: Main WebDriver implementation extending RemoteWebDriver with Firefox-specific capabilities
  • GeckoDriverService: Manages the GeckoDriver executable lifecycle and communication
  • FirefoxOptions: Configuration builder for browser settings, preferences, and capabilities
  • FirefoxProfile: User profile management for customization and extension handling
  • Context Management: Switching between content and chrome contexts for advanced automation
  • Extension System: Installing and managing Firefox browser extensions
  • BiDi Protocol: Modern WebDriver BiDi support for advanced browser automation

Capabilities

Driver Management

Core Firefox WebDriver functionality including driver instantiation, configuration, and lifecycle management. Supports both local and remote execution modes.

// Main driver class
public class FirefoxDriver extends RemoteWebDriver 
    implements WebStorage, HasExtensions, HasFullPageScreenshot, HasContext, HasBiDi {
    
    public FirefoxDriver();
    public FirefoxDriver(FirefoxOptions options);
    public FirefoxDriver(FirefoxDriverService service);
    public FirefoxDriver(FirefoxDriverService service, FirefoxOptions options);
    public static RemoteWebDriverBuilder builder();
    
    // System properties for configuration
    public static final class SystemProperty {
        public static final String BROWSER_BINARY = "webdriver.firefox.bin";
        public static final String BROWSER_PROFILE = "webdriver.firefox.profile";
    }
}

Driver Management

Browser Configuration

Comprehensive configuration system for Firefox browser settings, preferences, command-line arguments, and capabilities. Includes Android device support and advanced options.

public class FirefoxOptions extends AbstractDriverOptions<FirefoxOptions> {
    public FirefoxOptions();
    public FirefoxOptions addPreference(String key, Object value);
    public FirefoxOptions addArguments(String... arguments);
    public FirefoxOptions setBinary(Path path);
    public FirefoxOptions setProfile(FirefoxProfile profile);
    public FirefoxOptions setLogLevel(FirefoxDriverLogLevel logLevel);
}

Browser Configuration

Profile Management

Firefox user profile creation, customization, and management including preferences, extensions, and certificate handling.

public class FirefoxProfile {
    public FirefoxProfile();
    public FirefoxProfile(File profileDir);
    public void setPreference(String key, Object value);
    public void addExtension(File extensionToInstall);
    public File layoutOnDisk();
}

Profile Management

Service Management

GeckoDriver service lifecycle management including executable location, logging configuration, and process control.

public class GeckoDriverService extends DriverService {
    public static GeckoDriverService createDefaultService();
    public static class Builder extends DriverService.Builder<GeckoDriverService, Builder> {
        public Builder withLogLevel(FirefoxDriverLogLevel logLevel);
    }
}

Service Management

Extension Management

Browser extension installation, management, and removal with support for temporary and permanent extensions.

public interface HasExtensions {
    String installExtension(Path path);
    String installExtension(Path path, Boolean temporary);
    void uninstallExtension(String extensionId);
}

Extension Management

Screenshot Capabilities

Full-page screenshot functionality beyond standard WebDriver screenshot capabilities.

public interface HasFullPageScreenshot {
    <X> X getFullPageScreenshotAs(OutputType<X> outputType);
}

Screenshot Capabilities

Context Management

Firefox-specific context switching between content and chrome contexts for advanced browser automation scenarios.

public interface HasContext {
    void setContext(FirefoxCommandContext context);
    FirefoxCommandContext getContext();
}

public enum FirefoxCommandContext {
    CONTENT("content"),
    CHROME("chrome");
}

Context Management

Common Types

// Log levels for GeckoDriver
public enum FirefoxDriverLogLevel {
    TRACE, DEBUG, CONFIG, INFO, WARN, ERROR, FATAL;
    
    public static FirefoxDriverLogLevel fromString(String text);
    public Map<String, String> toJson();
}

// Exception for profile creation failures
public class UnableToCreateProfileException extends WebDriverException {
    public UnableToCreateProfileException(String message);
    public UnableToCreateProfileException(Throwable cause);
}

// Extension interface
public interface Extension {
    void writeTo(File parentDirectory);
}