Selenium Grid server that enables distributed test execution across multiple browsers and operating systems.
—
The Selenium Grid server provides a flexible configuration system supporting multiple sources with well-defined precedence rules for enterprise deployment scenarios.
Core interface for accessing configuration values throughout the Grid server.
package org.openqa.selenium.grid.config;
import java.util.Optional;
interface Config {
/**
* Get configuration value as Optional string
* @param section Configuration section name
* @param option Configuration option name
* @return Optional containing value if present
*/
Optional<String> get(String section, String option);
/**
* Get configuration value as Optional integer
* @param section Configuration section name
* @param option Configuration option name
* @return Optional containing integer value if present and parseable
*/
default Optional<Integer> getInt(String section, String option) {
return get(section, option).map(Integer::parseInt);
}
/**
* Get configuration value as Optional boolean
* @param section Configuration section name
* @param option Configuration option name
* @return Optional containing boolean value if present and parseable
*/
default Optional<Boolean> getBool(String section, String option) {
return get(section, option).map(Boolean::parseBoolean);
}
}Configuration sources are applied in order of precedence (highest to lowest):
// Precedence order (1 = highest priority)
1. AnnotatedConfig // From @ConfigValue annotations on flag classes
2. EnvConfig // Environment variables (section.option format)
3. ConcatenatingConfig // System properties (selenium.section.option format)
4. CompoundConfig // Combines multiple configuration sourcesSet configuration using environment variables with section.option format:
# Environment variable format
export section.option=value
# Examples
export server.port=4444
export server.hostname=grid-hub.example.com
export node.detect-drivers=true
export distributor.port=5553Set configuration using Java system properties with selenium prefix:
# System property format
-Dselenium.section.option=value
# Examples
java -Dselenium.server.port=4444 -jar selenium-server.jar standalone
java -Dselenium.node.detect-drivers=true -jar selenium-server.jar nodeBasic server configuration options available for all components.
// server section options
server.hostname // Server hostname or IP address
server.port // Port number to listen on
server.max-threads // Maximum number of Jetty threadsExamples:
# Environment variables
export server.hostname=0.0.0.0
export server.port=4444
export server.max-threads=200
# System properties
-Dselenium.server.hostname=grid-hub.local
-Dselenium.server.port=4445Configuration specific to the distributor component.
// distributor section options
distributor.host // Distributor URI or hostname
distributor.port // Distributor port number
distributor.hostname // Distributor hostnameExamples:
# Environment variables
export distributor.host=http://distributor-service:5553
export distributor.port=5553
export distributor.hostname=distributor.grid.local
# System properties
-Dselenium.distributor.host=http://localhost:5553
-Dselenium.distributor.port=5553Configuration for the session map component.
// sessions section options
sessions.host // Session map URI or hostname
sessions.port // Session map port number
sessions.hostname // Session map hostnameExamples:
# Environment variables
export sessions.host=http://sessions-service:5556
export sessions.port=5556
export sessions.hostname=sessions.grid.local
# System properties
-Dselenium.sessions.host=http://localhost:5556
-Dselenium.sessions.port=5556Configuration specific to node components.
// node section options
node.detect-drivers // Boolean flag to auto-detect available driversExamples:
# Environment variables
export node.detect-drivers=true
# System properties
-Dselenium.node.detect-drivers=trueThe configuration system uses specific option classes for type-safe configuration access.
Base server configuration options used by all server components.
class BaseServerOptions {
// Server hostname (defaults to auto-detected)
String getHostname();
// Server port number
int getPort();
// Maximum Jetty threads
int getMaxThreads();
}Configuration options specific to session map components.
class SessionMapOptions {
// Session map service URI
URI getSessionMap();
// Session map hostname
String getSessionMapHost();
// Session map port
int getSessionMapPort();
}Configuration options for distributor components.
class DistributorOptions {
// Distributor service URI
URI getDistributor();
// Distributor hostname
String getDistributorHost();
// Distributor port
int getDistributorPort();
}# Using environment variables
export server.port=4440
export server.hostname=192.168.1.100
export node.detect-drivers=true
java -jar selenium-server.jar standalone# Using system properties
java -Dselenium.server.port=4440 \
-Dselenium.server.hostname=192.168.1.100 \
-Dselenium.node.detect-drivers=true \
-jar selenium-server.jar standaloneHub configuration:
# Hub server
export server.port=4444
export server.hostname=hub.grid.local
java -jar selenium-server.jar hubNode configuration:
# Node server
export server.port=5555
export distributor.host=http://hub.grid.local:4444
export sessions.host=http://hub.grid.local:4444
export node.detect-drivers=true
java -jar selenium-server.jar nodeRouter service:
export server.port=4444
java -jar selenium-server.jar routerDistributor service:
export server.port=5553
java -jar selenium-server.jar distributorSession map service:
export server.port=5556
java -jar selenium-server.jar sessionsNode service:
export server.port=5555
export distributor.host=http://distributor-host:5553
export sessions.host=http://sessions-host:5556
java -jar selenium-server.jar nodeWhen no configuration is provided, the system uses these defaults:
// Default configuration values
server.hostname = "0.0.0.0" // Listen on all interfaces
server.port = 4444 // Standard Selenium port (hub/router/standalone)
server.port = 5555 // Standard node port
server.port = 5553 // Standard distributor port
server.port = 5556 // Standard session map port
node.detect-drivers = false // Manual driver configurationThe configuration system validates values at startup and provides clear error messages for invalid configurations:
// Common validation errors
"Invalid port number: must be between 1 and 65535"
"Invalid hostname format"
"Cannot connect to distributor at specified URI"
"Required configuration option not provided: distributor.host"Install with Tessl CLI
npx tessl i tessl/maven-org-seleniumhq-selenium--selenium-server