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.1.tar.gz (10.7 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.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: drivermanagementpro-1.0.1.tar.gz
  • Upload date:
  • Size: 10.7 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.1.tar.gz
Algorithm Hash digest
SHA256 3feac53248977b5fbdb9613144368627ff84fa10b85859fa575d5afb4ec95208
MD5 b5a5a1fabfdb6b8804785abe11b0d381
BLAKE2b-256 9ac7644628c6be578cb8d6fc492455831f628c8f3c551e99b91661371691a9ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for drivermanagementpro-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6455f12539accb75e282740777b9297b5e927ea5e7728b8254455093c0426d2d
MD5 7bd006e67c33c39b47ffdf246437d136
BLAKE2b-256 83f527a9778c1fc96a2d2daf62889616863aeb4737b388e6dff5cad287a2d521

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