Skip to main content

Smart WebDriver management library with automatic caching

Project description

driverManagementPro

Python License

Smart WebDriver management library with automatic caching - No rate limiting, no re-downloads!

๐ŸŽฏ Why driverManagementPro?

Problem

  • Running tests on 100+ systems simultaneously causes GitHub API rate limiting
  • Downloading drivers repeatedly wastes bandwidth and time
  • WebDriver Manager API gets exhausted quickly

Solution

  • โœ… Smart Caching - Download once, use everywhere
  • โœ… Automatic - Downloads only on first run
  • โœ… No Rate Limiting - Never hits GitHub API again
  • โœ… Lightweight - Pure Python, minimal dependencies
  • โœ… Easy to Use - One-liner driver setup

๐Ÿ“ฆ Installation

From PyPI (Recommended)

pip install driverManagementPro

From Source

git clone https://github.com/yourusername/driverManagementPro.git
cd driverManagementPro
pip install -e .

๐Ÿš€ Quick Start

Basic Usage

from driverManagementPro import DriverManager

# Initialize manager
manager = DriverManager()

# Get Chrome driver (auto-downloads if needed)
driver = manager.get_chrome_driver()
driver.get("https://www.google.com")
driver.quit()

Firefox Driver

driver = manager.get_firefox_driver()
driver.get("https://www.google.com")
driver.quit()

Edge Driver

driver = manager.get_edge_driver()
driver.get("https://www.google.com")
driver.quit()

Custom Cache Directory

manager = DriverManager(cache_dir="C:\\custom\\driver\\path")
driver = manager.get_chrome_driver()

Custom Driver Versions

# Specific Chrome version
driver = manager.get_chrome_driver(version="122.0.0.0")

# Specific Firefox version
driver = manager.get_firefox_driver(version="v0.33.2")

# Specific Edge version
driver = manager.get_edge_driver(version="122.0.0.0")

Custom Chrome Options

from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument("--headless")
options.add_argument("--no-sandbox")

driver = manager.get_chrome_driver(options=options)

๐Ÿ“ Cache Structure

Drivers are cached in user home directory:

~/driverManagementPro/
โ”œโ”€โ”€ chrome/
โ”‚   โ”œโ”€โ”€ 123.0.0.0/
โ”‚   โ”‚   โ””โ”€โ”€ chromedriver.exe
โ”‚   โ””โ”€โ”€ 124.0.0.0/
โ”‚       โ””โ”€โ”€ chromedriver.exe
โ”œโ”€โ”€ firefox/
โ”‚   โ”œโ”€โ”€ v0.33.3/
โ”‚   โ”‚   โ””โ”€โ”€ geckodriver.exe
โ”‚   โ””โ”€โ”€ v0.33.2/
โ”‚       โ””โ”€โ”€ geckodriver.exe
โ””โ”€โ”€ edge/
    โ”œโ”€โ”€ 123.0.0.0/
    โ”‚   โ””โ”€โ”€ msedgedriver.exe
    โ””โ”€โ”€ 124.0.0.0/
        โ””โ”€โ”€ msedgedriver.exe

๐Ÿ”ง Advanced Usage

Check Cache Status

manager = DriverManager()

# List all cached drivers
cached = manager.list_cached_drivers()
print(cached)
# Output: {'chrome': ['123.0.0.0', '124.0.0.0'], 'firefox': ['v0.33.3']}

# Health check
if manager.health_check():
    print("โœ… Cache directory is accessible")
else:
    print("โŒ Cache directory issue")

Clear Cache

manager = DriverManager()

# Clear all drivers
manager.clear_cache()

# Clear all Chrome drivers
manager.clear_cache("chrome")

# Clear specific version
manager.clear_cache("chrome", "123.0.0.0")

Debug Mode

manager = DriverManager(debug=True)
driver = manager.get_chrome_driver()  # Verbose logging

๐Ÿข Use Cases

Single System (Local Development)

from driverManagementPro import DriverManager

manager = DriverManager()
driver = manager.get_chrome_driver()
# Drivers cached locally - subsequent runs are instant

Multiple Systems (QA Teams)

# System 1: Downloads driver once
manager = DriverManager()
driver = manager.get_chrome_driver()

# System 2-100: Use cached drivers instantly
# No GitHub API calls, no rate limiting!

CI/CD Pipelines

# Jenkins, GitHub Actions, Azure Pipelines
import os
from driverManagementPro import DriverManager

# Optional: use custom cache directory
cache_path = os.getenv("DRIVER_CACHE", None)
manager = DriverManager(cache_dir=cache_path)

driver = manager.get_chrome_driver()
# Run your tests...
driver.quit()

Packaged Applications (EXE)

# Your Python application packaged as EXE
# Drivers are cached on first run
# Subsequent runs use cached drivers

from driverManagementPro import DriverManager

manager = DriverManager()
driver = manager.get_chrome_driver()
# Works perfectly when distributed to clients!

๐Ÿ“Š Performance Comparison

Scenario Without Cache With driverManagementPro
First Run 30-60 sec 30-60 sec (download)
2nd-100th Run 30-60 sec each < 1 sec each
100 systems, 1st time โŒ Rate Limited โœ… Works fine
Bandwidth 500 MB total 5 MB (one download)

๐Ÿ” Security

  • No credentials stored in code
  • No hardcoded tokens needed
  • Local cache only - drivers never exposed
  • HTTPS downloads from official sources

๐Ÿ› Troubleshooting

Issue: "Failed to get ChromeDriver"

Solution 1: Check connectivity

manager = DriverManager(debug=True)
manager.health_check()

Solution 2: Clear cache and retry

manager.clear_cache("chrome", "123.0.0.0")
driver = manager.get_chrome_driver(version="123.0.0.0")

Solution 3: Use different version

# Try a different version
driver = manager.get_chrome_driver(version="122.0.0.0")

Issue: Permission denied (Linux/Mac)

Solution:

chmod +x ~/driverManagementPro/*/chromedriver
chmod +x ~/driverManagementPro/*/geckodriver

Issue: Cache directory not accessible

Solution:

# Use custom writable directory
manager = DriverManager(cache_dir="/tmp/drivers")

๐Ÿงช Testing

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# With coverage
pytest --cov=driverManagementPro

๐Ÿ“ License

MIT License - See LICENSE file for details

๐Ÿค Contributing

Contributions welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Submit a pull request

๐Ÿ“ž Support


Made with โค๏ธ for QA Teams

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drivermanagementpro-1.0.3.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drivermanagementpro-1.0.3-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file drivermanagementpro-1.0.3.tar.gz.

File metadata

  • Download URL: drivermanagementpro-1.0.3.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.1

File hashes

Hashes for drivermanagementpro-1.0.3.tar.gz
Algorithm Hash digest
SHA256 57b3b43737ddbd317975e773966c570b04c3d34b61377db7b43473f57addd40d
MD5 47f35086567fabc6489da79f020c17e1
BLAKE2b-256 7aea876af7d61e919962e51c8a76348ac2ad322f5b476d2ad386226ea1a746f4

See more details on using hashes here.

File details

Details for the file drivermanagementpro-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for drivermanagementpro-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bf00d3430fd58b03fc4e25607c86c83fe8051e10cfa54647881e6930111ab84d
MD5 0a46c9564aa16629845ed83a74f111e9
BLAKE2b-256 44d49cb58880037ce5ee2d548d94798a2ef15a142c34b71aa229ff006aae9315

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page