ScreenshotNeo

BlogEngineering

How Selenium Is Built: A Guide to the Selenium Build Process

Learn how Selenium’s Bazel build coordinates code across languages, what it produces, and how to find the current steps for building from source.

By the ScreenshotNeo team4 October 20268 min read

Selenium uses Bazel to coordinate a build that spans multiple programming languages and shared components. The build turns source code and related artifacts into distributable outputs such as Selenium Server and language bindings. Bazel models dependencies as a directed acyclic graph (DAG), which lets it identify independent tasks that can run in parallel.

This guide explains the build’s purpose and design, distinguishes building Selenium from using it in a test project, and shows how to approach a source build without relying on potentially stale commands. Selenium’s published build explanation dates to June 12, 2023; check the current repository instructions for exact prerequisites and commands.

1. What does it mean to build Selenium?

A build converts source code and related artifacts into outputs that the project distributes. Selenium’s build explanation gives Selenium Server and language bindings as examples of those outputs. It is not simply compiling one application: the project coordinates components written in different languages and reuses some artifacts across them.

Examples of shared pieces described by Selenium include reusable JavaScript “atoms,” shared descriptions of Chrome DevTools Protocol (CDP) capabilities, and Selenium Manager, a Rust tool bundled with language bindings. The build has to produce a coherent set of components from those related pieces.

2. Why Selenium uses Bazel

Selenium’s stated reason for choosing Bazel is the need for one extensible build tool that can coordinate work across different languages. Separate language-focused build tools would not, by themselves, describe the full set of relationships among shared and language-specific project components.

Bazel represents those relationships as a dependency graph. A task declares what it needs; tasks whose inputs are ready and that do not depend on each other can run in parallel. This can make builds faster, but Selenium’s explanation does not publish a measured speedup, so there is no substantiated percentage or time saving to quote.

Declared dependencies also help describe the tools and inputs a build needs. Selenium’s article says Bazel can obtain tools required by the build, reducing manual setup of unfamiliar toolchains. The first build may still take time while dependencies are downloaded.

3. What the build produces

The build’s outputs include distributable Selenium components, notably the server and language bindings. Bindings provide language-specific ways for test code to use Selenium’s browser automation capabilities. The exact artifact set can vary by component and release; use Selenium’s current component and download documentation for the current published packages.

The project also needs to keep shared functionality consistent across bindings. Building the repository brings the relevant source and shared artifacts together under the project’s build definitions. Installing a released binding into your own project consumes an output of that process; it does not rebuild Selenium itself.

4. Building Selenium versus using Selenium

Question Build Selenium from source Use Selenium in your project
Goal Contribute to Selenium or produce project artifacts Write and run browser automation tests
Starting point The Selenium source repository and its contributor instructions Your application or test project
Typical output Build outputs for Selenium components A test project that depends on a released Selenium binding
Setup path Follow the repository’s current build documentation Declare the appropriate binding using its language’s package workflow

For example, a Java test project normally declares Selenium dependencies through Maven or Gradle, as described in the official installation guide. That is dependency setup for a consumer project, not a source build of the Selenium repository.

5. How to approach a source build

Selenium’s build article gives a high-level onboarding outline: clone the repository, install Bazel, and run the build. It does not establish a complete, currently verified command sequence, supported tool versions, or all prerequisites. Use the repository’s current contributor instructions as the authority for those details.

  1. Choose the right workflow. If your aim is to write tests, install a Selenium binding in your project. If you intend to work on Selenium itself, continue with a source checkout.
  2. Read the current contributor documentation. Check the repository’s contribution and build instructions before installing tools. Confirm the required Bazel version, language runtimes, platform notes, and any setup steps listed there.
  3. Clone the official repository. Follow the clone instructions provided by Selenium’s repository documentation so you use the intended source and branch.
  4. Install the documented build tooling. Use the version and installation path specified by the current repository instructions rather than assuming the 2023 overview still matches today’s setup.
  5. Run the documented build target. Use the exact command and target from the current instructions. Avoid guessing a universal target: this research does not establish one.
  6. Allow for initial downloads. The first build can take longer while dependencies and tools are obtained. Once it finishes, inspect the command output for the locations and names of generated artifacts.
  7. Make a focused change and rebuild. Bazel’s dependency graph can help determine which affected tasks need to run. Follow project guidance for checks and tests associated with your change.

For current repository details, start at the official Selenium repository. For consumer setup, consult the official Selenium installation guide and the component overview.

6. What Bazel’s dependency graph changes

A dependency graph makes task relationships explicit. If task C needs outputs from task A, the build system must complete A before C. If task B is independent of A, the system may be able to run A and B concurrently. The graph also helps the build determine what work is relevant when inputs change.

This model matters in a multi-language project because one change may affect shared components and several downstream outputs. The graph helps represent those connections in one coordinated build. It does not mean every task always runs in parallel: dependencies, available machine resources, and the particular build target constrain what can run at once.

7. Performance, reliability, and cost considerations

  • First-build time: Budget extra time for dependency and tool downloads. Network speed, cache state, and the selected target affect the experience; no fixed duration is established by the cited build explanation.
  • Subsequent work: A dependency-aware build can avoid treating every task as independent full-project work. The actual benefit depends on the change, target, and local build state; Selenium publishes no speed benchmark in the cited explanation.
  • Reliability: Use the versions and environment specified by current repository documentation. Changing tool versions or relying on undeclared local setup can make results harder to reproduce.
  • Machine resources: Parallel tasks can use more CPU, memory, and disk bandwidth at once. If a build struggles, use the build tool’s documented controls and repository guidance rather than assuming more parallelism is always better.
  • Network and storage: Initial downloads require network access and local disk space for dependencies and outputs. A slow or interrupted connection can delay setup; rerun according to the current Bazel and Selenium guidance.
  • Financial cost: Building from source uses your own development machine or any infrastructure you choose. The cited Selenium article gives no hosted build price or cost benchmark.

8. Troubleshooting a Selenium source build

Symptom Likely cause What to do
Bazel command is missing The build tool is not installed or is not on the shell path. Recheck the current repository’s Bazel installation instructions and verify the executable is available in the environment used for the build.
Version or compatibility error The installed tool version does not match the project’s expected version, or setup instructions have changed. Use the version stated by current contributor documentation; do not infer it from an older overview.
Build pauses or fails while fetching dependencies Downloads are still in progress, network access is restricted, or a fetch failed. Check network access and the specific fetch error, then follow the repository and Bazel guidance for retrying. Allow for downloads on an initial build.
A target cannot be found The target name is incorrect, has changed, or is not part of the selected checkout. Use the target documented for your task or discover targets using the current Bazel and repository instructions.
Build fails after a local change The change may break compilation, generated inputs, or a dependent component. Read the first actionable error in the build output, check the affected target and its declared dependencies, and run the relevant documented checks.
Local build differs from CI Tool versions, platform, environment, or build options may differ. Compare your setup with the current project and CI documentation where available, and reproduce the documented environment before diagnosing code differences.
Java project cannot find Selenium classes The consumer project has not declared the appropriate Selenium dependency, or dependency resolution failed. Follow the official Maven or Gradle installation instructions. This is a consumer dependency issue, not a reason to build the Selenium repository.

9. Capturing a browser page while developing

If your Selenium work involves comparing rendered pages or documenting a browser state, a screenshot can help make the result reviewable. You can capture a page yourself with Selenium or use a screenshot API. For visual capture with Selenium, choose the screenshot method supported by your binding and driver; full-page behavior and element capture can vary by browser and implementation.

ScreenshotNeo is a website screenshot API and MCP server made by Yorker Media. A single GET request can return a PNG, JPEG, WebP, or PDF. See the ScreenshotNeo site and its API documentation for request options and response details.

10. Or skip the browser setup

For a page capture, call the ScreenshotNeo API directly. Replace the URL with the page you need and provide your API key:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo removes cookie banners, newsletter popups, and chat widgets before the shot. Bot checks, blank pages, and failed loads are never billed. Its MCP server gives AI agents screenshot tools. The free plan includes 1,000 screenshots a month with no card; paid plans start at $5 for 3,000 screenshots. The same plans include every feature, and yearly billing gives two months free. Read the API docs for the other capture options and response headers.

Create a free ScreenshotNeo account for 1,000 screenshots a month, with no card required.

11. Frequently asked questions

Is Bazel the same thing as Selenium?

No. Bazel is the build system Selenium uses to coordinate its source build; Selenium is the browser automation project and its distributed components.

Does building Selenium install a browser driver for my tests?

A source build produces project artifacts. Setting up and running browser automation in a consumer project is a separate workflow; consult Selenium’s current WebDriver documentation for driver setup.

Can I know the exact current build command from the 2023 article?

No. It describes the broad onboarding idea, not a verified current command recipe. Use the live repository’s contributor instructions for exact commands and prerequisites.

Does Bazel guarantee a faster build?

No fixed speedup is guaranteed. Selenium’s explanation describes parallel work as a reason builds can be faster, but it does not publish a benchmark.

Where should a new contributor begin?

Begin with the official Selenium repository and its current contribution guidance, then follow the build instructions for the component or change you intend to work on.