Principle:SeleniumHQ Selenium Coding Convention Compliance
| Knowledge Sources | |
|---|---|
| Domains | Code_Quality, Developer_Experience, Standards |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
Set of language-specific coding standards governing logging, deprecation, documentation, and style for contributions to the Selenium polyglot monorepo.
Description
Each language binding in the Selenium monorepo has its own AGENTS.md file defining coding conventions. Common principles across all languages include: use appropriate logging levels (not print statements), mark deprecated features with messages pointing to alternatives (the project does not follow semver, so deprecated functionality must be marked before removal), add documentation comments for public APIs, and include Apache 2.0 license headers on every file. Language-specific conventions cover import ordering, naming, type annotations, test structure, and build configuration. Every file must carry the Software Freedom Conservancy license header boilerplate.
Usage
Consult the language-specific AGENTS.md before making changes. Follow the conventions for logging, deprecation, and documentation in every contribution. When changing user-visible behavior, compare with at least one other binding for cross-binding consistency.
Theoretical Basis
# Cross-Language Convention Summary
Logging:
Java: java.util.logging.Logger
LOG.warning("actionable"), LOG.info("useful"), LOG.fine("diagnostic")
Python: logging module
logger.warning("actionable"), logger.info("useful"), logger.debug("diagnostic")
Ruby: WebDriver.logger
.warn("actionable", id: :id), .info("useful"), .debug("diagnostic")
Rust: log crate
warn!("actionable"), info!("useful"), debug!("diagnostic")
.NET: OpenQA.Selenium.Internal.Logging
_logger.Warn("actionable"), _logger.Info("useful"), _logger.Debug("diagnostic")
Deprecation:
Java: @Deprecated(forRemoval = true) + Javadoc @deprecated
Python: warnings.warn("message", DeprecationWarning, stacklevel=2)
Ruby: WebDriver.logger.deprecate("OldClass#old_method", "NewClass#new_method", id: :old_method)
Rust: #[deprecated(since = "0.1.0", note = "Use new_function instead")]
.NET: [Obsolete("Use NewMethod instead")]
Documentation:
Java: Javadoc (/** */ with @param, @return, @throws)
Python: Google-style docstrings (Args:, Returns:, Raises:)
Ruby: YARD (@param, @return, @raise, @api private for internals)
Rust: /// doc comments (# Arguments, # Returns, # Errors)
.NET: XML doc comments (/// <summary>, <param>, <returns>, <exception>)
Type Safety:
Python: Type hints required on new code
Ruby: Update .rbs files in rb/sig/ when changing public API
.NET: Migrating to async patterns