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.0.tar.gz (10.6 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.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: drivermanagementpro-1.0.0.tar.gz
  • Upload date:
  • Size: 10.6 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.0.tar.gz
Algorithm Hash digest
SHA256 1762f24ea1e7c8101ffe55474fbc227ceda6fe844fc6760285d3d5439dcaa27f
MD5 a411f9db52d3b310bd80769d2f236d9e
BLAKE2b-256 77e89a08a6df1efc957c789bfc423dc62713c1a984159936909847d88691a73a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for drivermanagementpro-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7fc5dd3cefd0eecd08486d7ea08110d6201dcf9dd3af063ea98daa4b5f9b4009
MD5 41471aa627630a974c31000c921bfcb8
BLAKE2b-256 133ebf1b26d6d55a49ff187982084a9f9b07a402a4ad1a880ee4168f4abca6fa

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