Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:SeleniumHQ Selenium Bootstrap Main Entry

From Leeroopedia
Knowledge Sources
Domains Distributed_Testing, Process_Management, Selenium_Grid
Last Updated 2026-02-11 00:00 GMT

Overview

Concrete tool for bootstrapping Selenium Grid from the command line provided by the Bootstrap and Main classes.

Description

Bootstrap is the JVM entry point (public static void main(String[] args)). It parses --ext flags for extension JAR paths (using File.pathSeparator as delimiter), creates a URLClassLoader with those JARs, wraps it in a custom PossessiveClassLoader (child-first classloader that only delegates java.*, javax.*, sun.*, and jdk.* prefixes to the parent), sets it as the thread context classloader, then reflectively loads and invokes Main.main(). Main uses ServiceLoader to discover all CliCommand implementations sorted by name via a TreeSet, matches args[0] to a command name using parallelStream().filter(), and calls command.configure(out, err, remainingArgs).run(). If no command matches, a built-in Help command displays all registered commands.

Usage

Invoked when running java -jar selenium-server.jar <command>. The first argument determines which Grid component starts.

Code Reference

Source Location

  • Repository: Selenium
  • File: java/src/org/openqa/selenium/grid/Bootstrap.java (L39-181)
  • File: java/src/org/openqa/selenium/grid/Main.java (L34-157)

Signature

public class Bootstrap {
    public static void main(String[] args);
    // Handles --ext for extensions via PossessiveClassLoader
    // Delegates to Main.main(args) via reflection
}

public class Main {
    public static void main(String[] args);
    Main(PrintStream out, PrintStream err, String[] args);
    void go();
    // Discovers CliCommand implementations via ServiceLoader
    // Matches args[0] to command name
    // Falls back to Help command if no match
}

Import

// Entry point classes - not directly imported by user code
// Invoked via: java -jar selenium-server.jar <command> [args]

I/O Contract

Inputs

Name Type Required Description
args[0] String No Command name: standalone, hub, node, distributor, router, sessions, sessionqueue. If omitted, displays help.
--ext String No File.pathSeparator-separated extension JAR paths or directories. Must be first argument if present.
remaining args String[] No Forwarded to the selected command's configure() method

Outputs

Name Type Description
Running Grid HTTP Server Grid component running on configured port
Help output Text (stdout) List of available commands with descriptions (if no command specified)

Usage Examples

# Standard standalone
java -jar selenium-server.jar standalone

# With extensions (colon-separated on Linux, semicolon on Windows)
java -jar selenium-server.jar --ext /path/to/extensions:/path/to/plugin.jar standalone --port 4444

# Help for a specific command
java -jar selenium-server.jar standalone --help

# List all available commands
java -jar selenium-server.jar

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment