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 BuildInfo

From Leeroopedia
Revision as of 11:49, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/SeleniumHQ_Selenium_BuildInfo.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Knowledge Sources
Domains WebDriver, Data_Model
Last Updated 2026-02-12 00:00 GMT

Overview

Concrete utility class for reading Selenium build metadata provided by the Selenium WebDriver library.

Description

BuildInfo is a read-only utility class that provides access to embedded build metadata for the current Selenium distribution. It loads properties from the /META-INF/selenium-build.properties resource file at class initialization time and exposes the version label and build revision through accessor methods. If the properties file is missing or a property is not set, the methods return the string "unknown". The toString() method returns a formatted summary string such as "Build info: version: '4.x.y', revision: 'abc123'".

Usage

Use BuildInfo when you need to programmatically determine which version of Selenium is running, for logging, diagnostics, or compatibility checks. It is typically used for debugging sessions, generating diagnostic reports, or verifying that the correct Selenium version is deployed.

Code Reference

Source Location

Signature

public class BuildInfo {
    private static final Properties BUILD_PROPERTIES = loadBuildProperties();

    public BuildInfo()

    public String getReleaseLabel()
    public String getBuildRevision()

    @Override public String toString()
}

Import

import org.openqa.selenium.BuildInfo;

I/O Contract

Method Return Type Description
getReleaseLabel() String Returns the Selenium version string (from the "Selenium-Version" property), or "unknown" if not available
getBuildRevision() String Returns the build revision/commit hash (from the "Build-Revision" property), or "unknown" if not available
toString() String Returns "Build info: version: '{version}', revision: '{revision}'"
Internal Resource Description
/META-INF/selenium-build.properties Properties file embedded in the Selenium JAR containing "Selenium-Version" and "Build-Revision" keys

Usage Examples

// Create a BuildInfo instance and retrieve version information
BuildInfo buildInfo = new BuildInfo();

// Get the Selenium release version
String version = buildInfo.getReleaseLabel();
System.out.println("Selenium version: " + version); // e.g., "4.18.0"

// Get the build revision (git commit hash)
String revision = buildInfo.getBuildRevision();
System.out.println("Build revision: " + revision); // e.g., "abc1234def"

// Print the full build info summary
System.out.println(buildInfo);
// Output: "Build info: version: '4.18.0', revision: 'abc1234def'"

// Use in diagnostic logging
import java.util.logging.Logger;
Logger logger = Logger.getLogger("MyTest");
logger.info("Running with " + new BuildInfo());

// Use for version compatibility checks
BuildInfo info = new BuildInfo();
if ("unknown".equals(info.getReleaseLabel())) {
    System.err.println("Warning: Cannot determine Selenium version");
}

Related Pages

Page Connections

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