or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

index.md
tile.json

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

Opera WebDriver implementation for browser automation, deprecated in favor of ChromeDriver with Opera binary path.

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

To install, run

npx @tessl/cli install tessl/maven-org-seleniumhq-selenium--selenium-opera-driver@4.4.0

index.mddocs/

Selenium Opera Driver

Selenium Opera Driver provides WebDriver implementation for controlling Opera browsers through the operadriver executable. This driver enables automated testing of web applications using Opera browsers but is deprecated due to operadriver's lack of W3C WebDriver standard support.

Package Information

  • Package Name: selenium-opera-driver
  • Package Type: maven
  • Language: Java
  • Group ID: org.seleniumhq.selenium
  • Artifact ID: selenium-opera-driver
  • Installation: Add to Maven dependencies or include in Bazel BUILD file

Maven dependency:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-opera-driver</artifactId>
    <version>4.4.0</version>
</dependency>

Core Imports

import org.openqa.selenium.opera.OperaDriver;
import org.openqa.selenium.opera.OperaOptions;
import org.openqa.selenium.opera.OperaDriverService;
import org.openqa.selenium.opera.OperaDriverInfo;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.html5.LocalStorage;
import org.openqa.selenium.html5.SessionStorage;
import org.openqa.selenium.html5.Location;
import org.openqa.selenium.html5.LocationContext;
import org.openqa.selenium.html5.WebStorage;
import org.openqa.selenium.remote.FileDetector;
import com.google.auto.service.AutoService;

Basic Usage

import org.openqa.selenium.opera.OperaDriver;
import org.openqa.selenium.opera.OperaOptions;
import org.openqa.selenium.opera.OperaDriverService;

// Basic usage with default options
OperaDriver driver = new OperaDriver();

// With custom options (recommended approach)
OperaOptions options = new OperaOptions();
options.setBinary("/path/to/opera");
options.addArguments("--headless", "--no-sandbox");
OperaDriver driver = new OperaDriver(options);

// With custom service configuration
OperaDriverService service = new OperaDriverService.Builder()
    .withVerbose(true)
    .withSilent(false)
    .usingAnyFreePort()
    .build();
OperaDriver driver = new OperaDriver(service, options);

// Use driver for automation
driver.get("https://example.com");
// ... perform actions
driver.quit();

Architecture

The Opera Driver consists of several key components:

  • OperaDriver: Main WebDriver implementation extending RemoteWebDriver
  • OperaDriverService: Manages operadriver executable lifecycle
  • OperaOptions: Configuration class for browser options and capabilities
  • OperaDriverInfo: Metadata provider and driver factory

Capabilities

Driver Creation and Management

Core driver instantiation and lifecycle management.

/**
 * Main WebDriver implementation for Opera browser automation
 */
public class OperaDriver extends RemoteWebDriver 
    implements LocationContext, WebStorage {
    
    // Default constructor with default service and options
    public OperaDriver();
    
    // Constructor with service
    public OperaDriver(OperaDriverService service);
    
    // Constructor with options (recommended)
    public OperaDriver(OperaOptions options);
    
    // Constructor with service and options
    public OperaDriver(OperaDriverService service, OperaOptions options);
    
    // Deprecated constructors with Capabilities
    @Deprecated
    public OperaDriver(Capabilities capabilities);
    
    @Deprecated
    public OperaDriver(OperaDriverService service, Capabilities capabilities);
}

Browser Configuration

Configuration of Opera browser options, extensions, and startup parameters.

/**
 * Configuration options for Opera browser
 */
@Deprecated
public class OperaOptions extends AbstractDriverOptions<OperaOptions> {
    
    public static final String CAPABILITY = "operaOptions";
    
    // Constructor
    public OperaOptions();
    
    // Merge capabilities
    public OperaOptions merge(Capabilities extraCapabilities);
    
    // Set Opera binary path
    public OperaOptions setBinary(File path);
    public OperaOptions setBinary(String path);
    
    // Add command line arguments
    public OperaOptions addArguments(String... arguments);
    public OperaOptions addArguments(List<String> arguments);
    
    // Add extensions
    public OperaOptions addExtensions(File... paths);
    public OperaOptions addExtensions(List<File> paths);
    public OperaOptions addEncodedExtensions(String... encoded);
    public OperaOptions addEncodedExtensions(List<String> encoded);
    
    // Experimental options
    public OperaOptions setExperimentalOption(String name, Object value);
    public Object getExperimentalOption(String name);
}

Service Management

Management of operadriver server process and configuration.

/**
 * Manages operadriver server lifecycle
 */
public class OperaDriverService extends DriverService {
    
    // System property constants
    public static final String OPERA_DRIVER_EXE_PROPERTY = "webdriver.opera.driver";
    public static final String OPERA_DRIVER_LOG_PROPERTY = "webdriver.opera.logfile";
    public static final String OPERA_DRIVER_VERBOSE_LOG_PROPERTY = "webdriver.opera.verboseLogging";
    public static final String OPERA_DRIVER_SILENT_OUTPUT_PROPERTY = "webdriver.opera.silentOutput";
    
    // Constructors
    public OperaDriverService(File executable, int port, List<String> args, 
                             Map<String, String> environment) throws IOException;
    
    public OperaDriverService(File executable, int port, Duration timeout, 
                             List<String> args, Map<String, String> environment) throws IOException;
    
    // Create default service
    public static OperaDriverService createDefaultService();
}

/**
 * Builder for OperaDriverService configuration
 */
@AutoService(DriverService.Builder.class)
public static class OperaDriverService.Builder 
    extends DriverService.Builder<OperaDriverService, OperaDriverService.Builder> {
    
    // Configure verbosity
    public Builder withVerbose(boolean verbose);
    
    // Configure silent mode
    public Builder withSilent(boolean silent);
    
    // Score capabilities match
    public int score(Capabilities capabilities);
    
    // Create the service
    protected OperaDriverService createDriverService(File exe, int port,
                                                     Duration timeout,
                                                     List<String> args,
                                                     Map<String, String> environment);
    
    // Find default executable
    protected File findDefaultExecutable();
    
    // Create command line arguments
    protected List<String> createArgs();
}

Web Storage and Location

HTML5 web storage and geolocation capabilities.

// OperaDriver implements these interfaces

/**
 * Local and session storage access
 */
public interface WebStorage {
    LocalStorage getLocalStorage();
    SessionStorage getSessionStorage();    
}

/**
 * Geolocation capabilities
 */
public interface LocationContext {
    Location location();
    void setLocation(Location location);
}

// OperaDriver implementation methods
public LocalStorage getLocalStorage();
public SessionStorage getSessionStorage();
public Location location();
public void setLocation(Location location);

// File detector override (throws exception)
public void setFileDetector(FileDetector detector); // throws WebDriverException

Driver Information

Metadata and factory methods for Opera driver discovery.

/**
 * Provides Opera driver metadata and factory methods
 */
@AutoService(WebDriverInfo.class)
public class OperaDriverInfo implements WebDriverInfo {
    
    // Display name
    public String getDisplayName(); // returns "Opera"
    
    // Canonical capabilities
    public Capabilities getCanonicalCapabilities();
    
    // Support checks
    public boolean isSupporting(Capabilities capabilities);
    public boolean isSupportingCdp(); // returns false
    public boolean isAvailable();
    
    // Session limits
    public int getMaximumSimultaneousSessions();
    
    // Driver creation
    public Optional<WebDriver> createDriver(Capabilities capabilities) 
        throws SessionNotCreatedException;
}

Important Notes

Deprecation Warning: This entire package is deprecated because operadriver does not support W3C WebDriver standards. The recommended alternative is to use ChromeDriver with Opera binary path:

import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

ChromeOptions options = new ChromeOptions();
options.setBinary(new File("/path/to/opera"));
ChromeDriver driver = new ChromeDriver(options);

System Properties:

  • webdriver.opera.driver: Path to operadriver executable
  • webdriver.opera.logfile: Path to log file
  • webdriver.opera.verboseLogging: Enable verbose logging (boolean)
  • webdriver.opera.silentOutput: Enable silent mode (boolean)

Required Dependencies:

  • operadriver executable must be available in PATH or specified via system property
  • Selenium Remote WebDriver dependencies
  • HTML5 support dependencies for LocationContext and WebStorage

Types

// Standard Selenium types used throughout the API  
interface Capabilities {
    Object getCapability(String capabilityName);
    String getBrowserName();
    Map<String, Object> asMap();
}

interface WebDriver {
    void get(String url);
    void quit();
    // ... other WebDriver methods
}

// HTML5 support interfaces
interface LocationContext {
    Location location();
    void setLocation(Location location);
}

interface WebStorage {
    LocalStorage getLocalStorage();
    SessionStorage getSessionStorage();
}

// Service types
abstract class DriverService {
    static Duration DEFAULT_TIMEOUT;
    File getExecutable();
    int getPort();
    void start() throws IOException;
    void stop();
}

abstract class DriverService.Builder<DS extends DriverService, B extends DriverService.Builder<?, ?>> {
    B usingDriverExecutable(File file);
    B usingAnyFreePort();
    B usingPort(int port);
    B withTimeout(Duration timeout);
    B withLogFile(File logFile);
    B withEnvironment(Map<String, String> environment);
    DS build();
}

// File system types
class File {
    File(String pathname);
    String getPath();
    String getAbsolutePath();
}

// Collection types  
interface List<T> {
    boolean add(T element);
    boolean addAll(Collection<? extends T> elements);
}

interface Map<K, V> {
    V put(K key, V value);
    V get(K key);
}

// HTML5 storage interfaces
interface LocalStorage {
    void setItem(String key, String value);
    String getItem(String key);
    void removeItem(String key);
}

interface SessionStorage {
    void setItem(String key, String value);
    String getItem(String key);
    void removeItem(String key);
}

interface Location {
    double getLatitude();
    double getLongitude();
    double getAltitude();
}

// Exception types
class IOException extends Exception {}
class WebDriverException extends RuntimeException {}
class SessionNotCreatedException extends WebDriverException {}
class IllegalStateException extends RuntimeException {}

// Annotation types  
@interface AutoService {
    Class<?>[] value();
}

@interface Deprecated {}

// Utility types
class Duration {
    static Duration ofSeconds(long seconds);
}

class Optional<T> {
    static <T> Optional<T> empty();
    static <T> Optional<T> of(T value);
    boolean isPresent();
    T get();
}