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.2.tar.gz (12.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.2-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: drivermanagementpro-1.0.2.tar.gz
  • Upload date:
  • Size: 12.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.2.tar.gz
Algorithm Hash digest
SHA256 0cec551d9853276335b5f04a6162d0012f5f95af6a6ccc41ee09d52634ca7a43
MD5 eb32433e158d6c1213e041d803174f72
BLAKE2b-256 14093cd68854915c0a48f4cd50d345536902be0329a0c6c91f5acf269475b90c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for drivermanagementpro-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5eca03c8dfb2adc005830f1c81f0a103e1bec0c0f43cb45df12f638866d02b2b
MD5 97c5c1b1ae556692ac910aea2295f754
BLAKE2b-256 d052de53085e9ebb12cdd367b8da1a1263492f31110e5f04b6af651cf303aa70

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