Implementation:SeleniumHQ Selenium Bazelisk JDK DevContainer Setup
| Knowledge Sources | |
|---|---|
| Domains | Developer_Experience, Build_Systems, Toolchain |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
External tool documentation for setting up the Selenium development environment using Bazelisk, JDK, and container-based options.
Description
The Selenium development environment requires Bazelisk (which auto-manages Bazel versions by reading the .bazelversion file) and JDK 17+ (e.g., Java 17 Temurin). The JAVA_HOME environment variable must point to the JDK installation directory, and javac must be available (not just the JRE). Three setup paths exist:
- Local installation with platform-specific tools:
- macOS: Xcode command-line tools (xcode-select --install), Rosetta for Apple Silicon (add build --host_platform=//:rosetta to .bazelrc.local)
- Windows: MSYS2 (set BAZEL_SH), Visual Studio Community with C++ workload (set BAZEL_VC and BAZEL_VC_FULL_VERSION), long path registry settings, and optionally startup --output_user_root=C:/tmp in .bazelrc.windows.local
- Linux: Standard package manager installs
- Dev Container (VS Code or IntelliJ extension using .devcontainer/devcontainer.json, which builds from scripts/dev-image/Dockerfile)
- Gitpod (cloud IDE using .gitpod.yml with a Supervisor task for VNC/noVNC, auto-configured Bazel cache at /workspace/.cache/, and jobs limited to 10)
Usage
Follow one of the three setup paths before contributing code. Verify with bazel --version and javac (the presence of javac confirms JDK, not just JRE).
Code Reference
Source Location
- Repository: Selenium
- File: README.md (L46-137)
- File: .devcontainer/devcontainer.json (L1-9)
- File: .gitpod.yml (L1-34)
Signature
# Local Setup (macOS)
xcode-select --install
# For Apple Silicon, add to .bazelrc.local:
# build --host_platform=//:rosetta
# Install Bazelisk via Homebrew or npm
brew install bazelisk
# Install JDK 17+
brew install openjdk@17
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
# Local Setup (Linux)
# Install Bazelisk binary from https://github.com/bazelbuild/bazelisk/releases
# Or via npm:
npm install -g @bazel/bazelisk
# Install JDK 17+
sudo apt install openjdk-17-jdk
export JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64
# Local Setup (Windows - PowerShell as Admin)
# Option 1: Automatic
# Run scripts/dev-environment-setup.ps1
# Option 2: Manual
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
# Install MSYS2, set BAZEL_SH=C:\tools\msys64\usr\bin\bash.exe
# Install Visual Studio Community with C++ workload
# Set BAZEL_VC, BAZEL_VC_FULL_VERSION
# Enable long paths via registry
# Verify
bazel --version
javac --version
Import
N/A - External tool setup
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| Platform | OS | Yes | macOS, Linux, or Windows |
| Setup path | Choice | Yes | Local, Dev Container, Gitpod, or Docker Image |
Outputs
| Name | Type | Description |
|---|---|---|
| Development environment | System | Bazel + JDK + platform tools ready for building Selenium |
Usage Examples
Dev Container
// .devcontainer/devcontainer.json
{
"name": "selenium-devcontainer",
"build": {
"dockerfile": "../scripts/dev-image/Dockerfile"
},
"runArgs": ["--name", "selenium_devcontainer"]
}
# In VS Code with Dev Containers extension:
# 1. Open the selenium repo folder
# 2. VS Code prompts "Reopen in Container"
# 3. Click "Reopen in Container"
# All tools are pre-installed in the container
Gitpod
# Open in Gitpod (browser-based):
# Navigate to: https://gitpod.io/#https://github.com/SeleniumHQ/selenium
# Gitpod auto-configures Bazel cache:
# build --repository_cache=/workspace/.cache/bazel-repo
# build --disk_cache=/workspace/.cache/bazel-disk
# build --jobs=10
# VNC available at port 5900, noVNC at port 7900
Windows Automatic Setup
# Open PowerShell as Administrator
Set-ExecutionPolicy Bypass -Scope Process -Force
# Navigate to parent directory of selenium clone
# Download and run: scripts/dev-environment-setup.ps1