Skip to main content

Browser Versions

PyPI version Python 3.6+ License: MIT Platform

A comprehensive Python package to programmatically detect web browser versions across different operating systems. This tool provides native OS detection without requiring Selenium or WebDrivers, making it perfect for automation scripts, system administration, and CI/CD pipelines.

Features

  • 🔍 Multi-Browser Support: Detect Chrome, Firefox, Edge, and Internet Explorer versions
  • 🖥️ Cross-Platform: Works on Windows, macOS, and Linux
  • 🏢 Enterprise Ready: Enhanced support for Windows Server 2019/2022 and enterprise deployments
  • 🛠️ Multiple Detection Methods: Registry queries, executable commands, and folder-based detection
  • 📝 Robust Error Handling: Comprehensive fallback mechanisms and logging
  • 🚀 Zero Dependencies: Uses only Python standard library
  • 💻 CLI Interface: Command-line tool for automation and scripting
  • 📦 Easy Integration: Simple API for use in Python applications

Supported Browsers

Browser Windows macOS Linux Notes
Google Chrome ✅ ✅ ✅ Includes Chromium
Mozilla Firefox ✅ ✅ ✅ Includes Firefox ESR
Microsoft Edge ✅ ✅ ✅ Includes Beta/Dev/Enterprise
Internet Explorer ✅ ❌ ❌ Windows only, deprecated

Supported Platforms

  • Windows: 7, 8, 10, 11, Server 2019/2022
  • macOS: 10.12 and later
  • Linux: Various distributions (Ubuntu, CentOS, RHEL, etc.)

Installation

pip install browser-versions

From Source

git clone https://github.com/pandiyarajk/browser-versions.git
cd browser-versions
pip install -e .

Quick Start

Command Line Usage

# Detect all browsers
browser-versions

# Detect specific browser
browser-versions --browser chrome

# Get version only (for scripting)
browser-versions --browser firefox --version-only

# Check script version
browser-versions --script-version

# Enable verbose logging
browser-versions --browser all --verbose

Python API Usage

from browser_versions import BrowserVersionDetector

# Create detector instance
detector = BrowserVersionDetector()

# Detect specific browser
chrome_version = detector.detect_chrome_version()
print(f"Chrome version: {chrome_version}")

# Detect all browsers
all_browsers = detector.detect_all_browsers()
for browser, info in all_browsers.items():
    if browser != 'platform':
        status = info['version'] if info['detected'] else 'Not found'
        print(f"{browser}: {status}")

Convenience Functions

from browser_versions import (
    get_chrome_version,
    get_firefox_version,
    get_edge_version,
    get_ie_version,
    get_all_browser_versions
)

# Quick version checks
chrome_ver = get_chrome_version()
firefox_ver = get_firefox_version()
edge_ver = get_edge_version()
ie_ver = get_ie_version()

# Get all versions at once
all_versions = get_all_browser_versions()

Output Examples

Standard Output

Browser Version Detection Results:
========================================
✓ Chrome: 120.0.6099.109
✓ Firefox: 120.0
✗ Edge: Not found
✗ Ie: Not found

Platform: win32

Version-Only Output (for scripting)

chrome: 120.0.6099.109
firefox: 120.0
edge: Not found
ie: Not found

API Reference

BrowserVersionDetector Class

The main class for browser version detection.

Methods

  • detect_chrome_version() → Optional[str]
  • detect_firefox_version() → Optional[str]
  • detect_edge_version() → Optional[str]
  • detect_ie_version() → Optional[str]
  • detect_all_browsers() → Dict[str, Any]

Example

detector = BrowserVersionDetector()

# Individual browser detection
chrome_ver = detector.detect_chrome_version()
if chrome_ver:
    print(f"Chrome {chrome_ver} detected")
else:
    print("Chrome not found")

# All browsers detection
results = detector.detect_all_browsers()
print(f"Platform: {results['platform']}")
for browser, info in results.items():
    if browser != 'platform':
        print(f"{browser}: {info['version'] if info['detected'] else 'Not found'}")

Convenience Functions

  • get_chrome_version() → Optional[str]
  • get_firefox_version() → Optional[str]
  • get_edge_version() → Optional[str]
  • get_ie_version() → Optional[str]
  • get_all_browser_versions() → Dict[str, Any]

Use Cases

System Administration

# Check browser versions across multiple systems
from browser_versions import get_all_browser_versions

def check_system_browsers():
    browsers = get_all_browser_versions()
    detected = [b for b, info in browsers.items() 
                if b != 'platform' and info['detected']]
    return detected

CI/CD Pipelines

# Check if required browser is available
if browser-versions --browser chrome --version-only | grep -q "Not found"; then
    echo "Chrome not found, installing..."
    # Install Chrome
fi

Automation Scripts

# Ensure compatible browser versions
from browser_versions import get_chrome_version

def check_chrome_compatibility():
    version = get_chrome_version()
    if not version:
        raise RuntimeError("Chrome not installed")
    
    major_version = int(version.split('.')[0])
    if major_version < 90:
        raise RuntimeError(f"Chrome version {version} is too old. Need 90+")
    
    return version

Development

Setup Development Environment

git clone https://github.com/pandiyarajk/browser-versions.git
cd browser-versions
pip install -e ".[dev]"

Running Tests

pytest

Code Formatting

black browser_versions.py
flake8 browser_versions.py
mypy browser_versions.py

Building Package

python -m build

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Pandiyaraj Karuppasamy - pandiyarajk@live.com

Acknowledgments

  • Thanks to the Python community for excellent tooling
  • Inspired by the need for reliable browser version detection in automation workflows
  • Built with enterprise environments in mind

Changelog

See CHANGELOG.md for a detailed history of changes.

Support


Note: Internet Explorer has been deprecated by Microsoft and may not be available on newer Windows versions. This tool includes IE detection for legacy system support.

Metadata

Release files for browser-versions 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for browser-versions 1.0.0
File Size Uploaded Provenance
browser_versions-1.0.0.tar.gz 16.3 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for browser-versions 1.0.0
File Interpreter ABI Platform
browser_versions-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 30.9 kB

Release files / browser_versions-1.0.0.tar.gz

Download URL browser_versions-1.0.0.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
064549ea9f0ebc09d3b8b71791ab484ae63cf1d8882405775f889fcda3e814f5
BLAKE2b-256 checksum
How to use checksums
7a7adb4180d9ffa8004b932a6e5ea9db0ec03f25a768ee3b221788d065444916
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Release files / browser_versions-1.0.0-py3-none-any.whl

Download URL browser_versions-1.0.0-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c761335582e500b21c26c504da3d910e61a66fae2eee01b1958f7ab4d754c524
BLAKE2b-256 checksum
How to use checksums
afaa1e1edbc8b11deea0231fdafecc4dbf744d62b87a39d93d50b5cd06d7710e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.9

Security for browser-versions 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page