Chromedriver Autoinstaller

0.6.4 · active · verified Tue Apr 14

chromedriver-autoinstaller is a Python library that automatically downloads and installs the appropriate Chromedriver executable for the currently installed version of Google Chrome on your system. It supports Linux, MacOS, and Windows operating systems. The current version is 0.6.4 and the library is actively maintained, with a recent release in January 2024.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use `chromedriver-autoinstaller` to ensure the correct Chromedriver is available, then initializes a Selenium WebDriver for Chrome, navigates to Google, prints the page title, and quits.

import chromedriver_autoinstaller
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import os

# Ensure chromedriver is installed and up-to-date
chromedriver_autoinstaller.install()

# Set up Chrome options (e.g., headless mode for automation)
chrome_options = Options()
# chrome_options.add_argument('--headless') # Uncomment for headless browsing
# chrome_options.add_argument('--no-sandbox') # Recommended for Linux environments, especially in CI/CD

# Initialize the WebDriver
driver = webdriver.Chrome(options=chrome_options)

# Navigate to a website
driver.get("https://www.google.com")

# Print the page title to verify
print(f"Page title: {driver.title}")

# Close the browser
driver.quit()

view raw JSON →