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
Overview
Eval results
Files

service-management.mddocs/

Service Management

ChromeDriverService provides comprehensive lifecycle management for the ChromeDriver executable, including configuration options for logging, security, and build compatibility.

Service Creation

Create Default Service

Create a ChromeDriverService with default configuration.

public static ChromeDriverService createDefaultService();

Returns: ChromeDriverService - Service instance configured with default settings

Usage Example:

import org.openqa.selenium.chrome.ChromeDriverService;

// Create default service
ChromeDriverService service = ChromeDriverService.createDefaultService();

// Use with driver
ChromeDriver driver = new ChromeDriver(service);

Service Builder

Use the Builder pattern for advanced service configuration.

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);
  public int score(Capabilities capabilities);
}

Usage Example:

import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.chromium.ChromiumDriverLogLevel;
import java.io.File;

ChromeDriverService service = new ChromeDriverService.Builder()
    .usingDriverExecutable(new File("/path/to/chromedriver"))
    .usingAnyFreePort()
    .withLogLevel(ChromiumDriverLogLevel.INFO)
    .withVerbose(false)
    .withAppendLog(true)
    .withLogFile(new File("/tmp/chromedriver.log"))
    .build();

Service Configuration

System Properties

ChromeDriverService supports various system properties for configuration:

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";

System Property Usage:

// Set system properties before creating service
System.setProperty("webdriver.chrome.driver", "/path/to/chromedriver");
System.setProperty("webdriver.chrome.logfile", "/tmp/chromedriver.log");
System.setProperty("webdriver.chrome.loglevel", "INFO");

ChromeDriverService service = ChromeDriverService.createDefaultService();

Logging Configuration

Log Level Configuration

Set the logging level for ChromeDriver output.

public Builder withLogLevel(ChromiumDriverLogLevel logLevel);

Parameters:

  • logLevel (ChromiumDriverLogLevel): Desired log level (ALL, INFO, DEBUG, WARNING, SEVERE, OFF)

Returns: Builder - Builder instance for method chaining

Usage Example:

import org.openqa.selenium.chromium.ChromiumDriverLogLevel;

ChromeDriverService service = new ChromeDriverService.Builder()
    .withLogLevel(ChromiumDriverLogLevel.DEBUG)
    .build();

Verbose Logging

Enable verbose logging for detailed output.

public Builder withVerbose(boolean verbose);

Parameters:

  • verbose (boolean): Enable verbose logging if true

Returns: Builder - Builder instance for method chaining

Silent Mode

Configure the service to run in silent mode with minimal output.

public Builder withSilent(boolean silent);

Parameters:

  • silent (boolean): Enable silent mode if true

Returns: Builder - Builder instance for method chaining

Log File Management

Configure log file appending behavior.

public Builder withAppendLog(boolean appendLog);

Parameters:

  • appendLog (boolean): Append to existing log file if true, overwrite if false

Returns: Builder - Builder instance for method chaining

Readable Timestamps

Configure timestamp formatting in log output.

public Builder withReadableTimestamp(Boolean readableTimestamp);

Parameters:

  • readableTimestamp (Boolean): Use human-readable timestamps if true

Returns: Builder - Builder instance for method chaining

Security Configuration

Allowed IP Addresses

Configure which IP addresses are allowed to connect to the ChromeDriver service.

public Builder withAllowedListIps(String allowedListIps);

Parameters:

  • allowedListIps (String): Comma-separated list of allowed IPv4 addresses

Returns: Builder - Builder instance for method chaining

Usage Example:

ChromeDriverService service = new ChromeDriverService.Builder()
    .withAllowedListIps("127.0.0.1,192.168.1.100")
    .build();

Compatibility Configuration

Build Check Configuration

Disable version compatibility checking between ChromeDriver and Chrome browser.

public Builder withBuildCheckDisabled(boolean noBuildCheck);

Parameters:

  • noBuildCheck (boolean): Disable build compatibility check if true

Returns: Builder - Builder instance for method chaining

Usage Example:

ChromeDriverService service = new ChromeDriverService.Builder()
    .withBuildCheckDisabled(true) // Allow potentially incompatible versions
    .build();

Service Information

Driver Name

Get the name of the driver executable.

public String getDriverName();

Returns: String - Driver executable name ("chromedriver")

Driver Property

Get the system property name for the driver executable path.

public String getDriverProperty();

Returns: String - System property name ("webdriver.chrome.driver")

Default Driver Options

Get the default capabilities for this driver service.

public Capabilities getDefaultDriverOptions();

Returns: Capabilities - Default ChromeOptions instance

Complete Configuration Example

import org.openqa.selenium.chrome.ChromeDriverService;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.chromium.ChromiumDriverLogLevel;
import java.io.File;
import java.time.Duration;

// Configure comprehensive service
ChromeDriverService service = new ChromeDriverService.Builder()
    .usingDriverExecutable(new File("/path/to/chromedriver"))
    .usingPort(9515)
    .withTimeout(Duration.ofSeconds(30))
    .withLogFile(new File("/tmp/chromedriver.log"))
    .withLogLevel(ChromiumDriverLogLevel.INFO)
    .withAppendLog(true)
    .withReadableTimestamp(true)
    .withAllowedListIps("127.0.0.1,10.0.0.0/8")
    .withBuildCheckDisabled(false)
    .build();

// Use configured service
ChromeOptions options = new ChromeOptions();
ChromeDriver driver = new ChromeDriver(service, options);

// Ensure cleanup
try {
    driver.get("https://example.com");
    // Test operations...
} finally {
    driver.quit();
}

Error Handling

Service-related exceptions that may occur:

  • WebDriverException - General service startup/shutdown issues
  • IOException - File system problems with logs or executable
  • IllegalArgumentException - Invalid configuration parameters
  • IllegalStateException - Service already started/stopped

Common troubleshooting:

  • Verify ChromeDriver executable exists and is executable
  • Check port availability and network connectivity
  • Ensure log file directory is writable
  • Validate IP address format for allowed lists

Install with Tessl CLI

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

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