CtrlK
BlogDocsLog inGet started
Tessl Logo

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

Selenium Chrome Driver provides WebDriver implementation for Google Chrome with Chrome DevTools Protocol support, network conditions simulation, permissions management, media casting capabilities, and Chrome-specific service configuration.

Pending
Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

SecuritybySnyk

Pending

The risk profile of this skill

Overview
Eval results
Files

index.mddocs/

Selenium Chromium Driver

Selenium Chromium Driver is a specialized WebDriver implementation that provides a unified interface for controlling Chromium-based browsers (Chrome, Edge, Opera) in automated testing and web scraping scenarios. It extends Selenium's core remote WebDriver functionality with Chromium-specific capabilities including Chrome DevTools Protocol (CDP) support, network conditions manipulation, permissions management, application launching, and media casting features.

Package Information

  • Package Name: selenium-chromium-driver
  • Package Type: Maven
  • Language: Java
  • Maven Coordinates: org.seleniumhq.selenium:selenium-chromium-driver:4.33.0
  • Installation: Add to your pom.xml:
<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-chromium-driver</artifactId>
  <version>4.33.0</version>
</dependency>

Core Imports

import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.chrome.ChromeDriverInfo;
import org.openqa.selenium.chromium.ChromiumNetworkConditions;
import org.openqa.selenium.chromium.HasCdp;
import org.openqa.selenium.chromium.HasCasting;
import org.openqa.selenium.chromium.HasNetworkConditions;
import org.openqa.selenium.chromium.HasPermissions;
import org.openqa.selenium.chromium.HasLaunchApp;

Basic Usage

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

// Basic Chrome driver usage with default service and options
ChromeDriver driver = new ChromeDriver();

// Configure Chrome options
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless", "--no-sandbox");
options.setBinary("/path/to/chrome");

// Create driver with options
ChromeDriver driverWithOptions = new ChromeDriver(options);

// Using custom service
ChromeDriverService service = ChromeDriverService.createDefaultService();
ChromeDriver driverWithService = new ChromeDriver(service, options);

// Use standard WebDriver methods
driver.get("https://example.com");
String title = driver.getTitle();

// Use Chrome-specific features (available through interfaces)
if (driver instanceof HasPermissions) {
    ((HasPermissions) driver).setPermission("camera", "granted");
}
if (driver instanceof HasLaunchApp) {
    ((HasLaunchApp) driver).launchApp("chrome-app-id");
}

// Clean up
driver.quit();

Architecture

The Selenium Chromium Driver is built around several key components:

  • ChromiumDriver: Main WebDriver implementation extending RemoteWebDriver with Chromium-specific interfaces
  • ChromiumOptions: Configuration system for browser setup, extensions, and experimental features
  • Capability Interfaces: Modular interfaces (HasCdp, HasCasting, etc.) that define specific browser capabilities
  • DevTools Integration: Chrome DevTools Protocol support for advanced debugging and automation
  • Network Simulation: ChromiumNetworkConditions for testing under various network scenarios
  • Augmenter System: AddHas* classes for dynamically adding capabilities to existing WebDriver instances

Capabilities

Chrome Driver

Chrome-specific WebDriver implementation providing seamless integration with Google Chrome browser.

public class ChromeDriver extends ChromiumDriver {
  public ChromeDriver();
  public ChromeDriver(ChromeDriverService service);
  public ChromeDriver(ChromeOptions options);
  public ChromeDriver(ChromeDriverService service, ChromeOptions options);
  public ChromeDriver(ChromeDriverService service, ChromeOptions options, ClientConfig clientConfig);
  
  public static RemoteWebDriverBuilder builder();
}

public class ChromeOptions extends ChromiumOptions<ChromeOptions> {
  public static final String CAPABILITY = "goog:chromeOptions";
  public static final String LOGGING_PREFS = "goog:loggingPrefs";
  
  public ChromeOptions();
  public ChromeOptions merge(Capabilities extraCapabilities);
}

public class ChromeDriverService extends DriverService {
  public static final String CHROME_DRIVER_NAME = "chromedriver";
  public static final String CHROME_DRIVER_EXE_PROPERTY = "webdriver.chrome.driver";
  
  public static ChromeDriverService createDefaultService();
  public String getDriverName();
  public String getDriverProperty();
  public Capabilities getDefaultDriverOptions();
}

WebDriver Operations

WebDriver Core Functionality

Standard WebDriver operations with Chromium-specific enhancements including script pinning, authentication handling, and enhanced element interaction.

public class ChromiumDriver extends RemoteWebDriver {
  public ScriptKey pin(String script);
  public Set<ScriptKey> getPinnedScripts();
  public void unpin(ScriptKey key);
  public Object executeScript(ScriptKey key, Object... args);
  public <X> void onLogEvent(EventType<X> kind);
  public void register(Predicate<URI> whenThisMatches, Supplier<Credentials> useTheseCredentials);
}

Browser Configuration

Comprehensive browser configuration including binary paths, command line arguments, extensions, and Android-specific settings.

public abstract class ChromiumOptions<T extends ChromiumOptions<?>> {
  public T setBinary(String path);
  public T addArguments(String... arguments);
  public T addExtensions(File... paths);
  public T addEncodedExtensions(String... encoded);
  public T setExperimentalOption(String name, Object value);
  public T enableBiDi();
}

Browser Configuration

Chrome DevTools Protocol

Execute Chrome DevTools Protocol commands for advanced browser control and debugging capabilities.

public interface HasCdp {
  Map<String, Object> executeCdpCommand(String commandName, Map<String, Object> parameters);
}

DevTools Protocol

Network Conditions Simulation

Simulate various network conditions for testing applications under different connectivity scenarios.

public interface HasNetworkConditions {
  ChromiumNetworkConditions getNetworkConditions();
  void setNetworkConditions(ChromiumNetworkConditions networkConditions);
  void deleteNetworkConditions();
}

public class ChromiumNetworkConditions {
  public boolean getOffline();
  public void setOffline(boolean offline);
  public Duration getLatency();
  public void setLatency(Duration latency);
  public int getDownloadThroughput();
  public void setDownloadThroughput(int downloadThroughput);
  public int getUploadThroughput();
  public void setUploadThroughput(int uploadThroughput);
}

Network Conditions

Media Casting

Cast media content to available devices using Chrome's casting capabilities.

public interface HasCasting {
  List<Map<String, String>> getCastSinks();
  void selectCastSink(String deviceName);
  void startDesktopMirroring(String deviceName);
  void startTabMirroring(String deviceName);
  String getCastIssueMessage();
  void stopCasting(String deviceName);
}

Media Casting

Permissions Management

Manage browser permissions for camera, microphone, geolocation, and other web APIs.

public interface HasPermissions {
  void setPermission(String name, String value);
}

Permissions Management

Application Launching

Launch Chromium applications and manage app lifecycles.

public interface HasLaunchApp {
  void launchApp(String id);
}

Application Launching

Service Management

Configure and manage ChromeDriverService for advanced driver lifecycle control.

public class ChromeDriverService extends DriverService {
  public static final String CHROME_DRIVER_NAME = "chromedriver";
  public static final String CHROME_DRIVER_EXE_PROPERTY = "webdriver.chrome.driver";
  public static final String CHROME_DRIVER_LOG_PROPERTY = "webdriver.chrome.logfile";
  public static final String CHROME_DRIVER_LOG_LEVEL_PROPERTY = "webdriver.chrome.loglevel";
  public static final String CHROME_DRIVER_VERBOSE_LOG_PROPERTY = "webdriver.chrome.verboseLogging";
  public static final String CHROME_DRIVER_SILENT_OUTPUT_PROPERTY = "webdriver.chrome.silentOutput";
  public static final String CHROME_DRIVER_APPEND_LOG_PROPERTY = "webdriver.chrome.appendLog";
  public static final String CHROME_DRIVER_ALLOWED_IPS_PROPERTY = "webdriver.chrome.withAllowedIps";
  public static final String CHROME_DRIVER_DISABLE_BUILD_CHECK = "webdriver.chrome.disableBuildCheck";
  public static final String CHROME_DRIVER_READABLE_TIMESTAMP = "webdriver.chrome.readableTimestamp";
  
  public static ChromeDriverService createDefaultService();
  public String getDriverName();
  public String getDriverProperty();
  public Capabilities getDefaultDriverOptions();
}

public static class Builder extends DriverService.Builder<ChromeDriverService, ChromeDriverService.Builder> {
  public Builder withAppendLog(boolean appendLog);
  public Builder withBuildCheckDisabled(boolean noBuildCheck);
  public Builder withLogLevel(ChromiumDriverLogLevel logLevel);
  public Builder withSilent(boolean silent);
  public Builder withVerbose(boolean verbose);
  public Builder withAllowedListIps(String allowedListIps);
  public Builder withReadableTimestamp(Boolean readableTimestamp);
}

Service Management

Common Types

// Predicate for checking if browser is Chromium-based
public static final Predicate<String> IS_CHROMIUM_BROWSER;

// Log level enumeration
public enum ChromiumDriverLogLevel {
  ALL, INFO, DEBUG, WARNING, SEVERE, OFF;
  
  public static ChromiumDriverLogLevel fromString(String text);
  public static ChromiumDriverLogLevel fromLevel(Level level);
}

// Driver information base class
public abstract class ChromiumDriverInfo implements WebDriverInfo {
  public int getMaximumSimultaneousSessions();
}

// Command executor for Chromium-specific commands
public class ChromiumDriverCommandExecutor extends DriverCommandExecutor {
  public ChromiumDriverCommandExecutor(DriverService service, Map<String, CommandInfo> extraCommands);
  public ChromiumDriverCommandExecutor(DriverService service, Map<String, CommandInfo> extraCommands, ClientConfig clientConfig);
}

Error Handling

The Chromium Driver may throw the following exceptions:

  • WebDriverException - For general WebDriver errors
  • SessionNotCreatedException - When browser session cannot be created
  • JavascriptException - For JavaScript execution errors
  • ConnectionFailedException - When DevTools connection fails
  • BiDiException - For BiDi protocol errors

Common error scenarios include missing browser binaries, invalid extension files, network connection issues, and unsupported DevTools commands.

docs

application-launching.md

browser-configuration.md

devtools-protocol.md

index.md

media-casting.md

network-conditions.md

permissions-management.md

service-management.md

webdriver-operations.md

tile.json