How to Install Chrome Driver Executable File in Selenium (with Python Example)

To be able to use Selenium, you will need to install a browser and the browser driver. Selenium supports multiple web browsers, but since Chrome has by far the greatest market share, this tutorial will show you how to install the ChromeDriver.

There are two ways to install a web driver in Selenium:

  • Manually
  • In Python, with webdriver_manager (simplest)

Install Selenium Web Driver Manually

Here are the steps to install the Chrome Selenium web driver manually:

Join the Newsletter

    1. Go to selenium.dev
    2. Clicks on Downloads next to Chromium/Chrome
    3. Select the version that matches your browser in chrome://settings/help
    4. Unzip the folder
    5. Run Selenium with Python

    Step 1: To install Selenium Webdriver, just go to selenium.dev and go to “Third Party Browser Drivers” section.

    Install Selenium Webdriver on Chrome
    Install Selenium Webdriver on Chrome
    Find your chrome version
    Find your chrome version using the 3 dots on the top right > help > About Google Chrome
    Install the right browser version
    Install the right browser version
    Choose the browser to install (Mac, Windows or Linux)

    Once the above steps are done, open Python and import webdriver from Selenium.

    from selenium import webdriver
    

    If everything was properly installed, you should get something like this.

    Selenium Webdrive Success Installation
    Selenium Webdriver Success Installation

    Next, we’ll set-up our browser.

    After, you will need to find the executable path of your chrome browser.

    To find it just chrome://version in your browser.

    To run Selenium that was installed manually you will need to pass the executable path as the value of the webdriver.Chrome() executable_path keyword.

    import time
    from selenium import webdriver
    
    # Define executable path
    executable_path = r"C:\Users\j-c.chouinard\Downloads\chromedriver_win32\chromedriver.exe" #Windows
    executable_path = '/path/to/ChromeDriver' # mac
    
    # Add Path to Chrome Driver
    driver = webdriver.Chrome(executable_path=executable_path)
    time.sleep(3) # Wait for 3 seconds, so that you can see something.
    driver.close()
    

    Install Selenium Web Driver with Python webdriver_manager

    The simplest way to install the Selenium Chromedriver is to install the webdriver_manager in Python.

    The webdriver_manager supports multiple browsers.

    • ChromeDriver,
    • GeckoDriver
    • EdgeChromiumDriver,
    • IEDriver
    • OperaDriver

    The webdriver_manager will manage your browsers.

    Use pip to install webdriver_manager.

    $ pip3 install webdriver-manager

    Once webdriver_manager installed, you can install the chrome driver using ChromeDriverManager. This operation will take some time.

    from selenium import webdriver
    from selenium.webdriver.chrome.service import Service
    from webdriver_manager.chrome import ChromeDriverManager
    
    # Install Webdriver
    service = Service(ChromeDriverManager().install())
    

    Once the web driver installed, you can start using Selenium.

    from selenium import webdriver
    from selenium.webdriver.chrome.service import Service
    from webdriver_manager.chrome import ChromeDriverManager
    import time 
    
    # Install Webdriver
    service = Service(ChromeDriverManager().install())
    
    # Create Driver Instance
    driver = webdriver.Chrome(service=service)
    
    # Get Web Page
    driver.get('https://www.crawler-test.com')
    time.sleep(1)
    driver.quit()
    

    If you have successfully installed and run Selenium, you can skip straight away to learning how to use Selenium.

    Conclusion

    Now that you have installed your Chrome Driver Manager, head back to our tutorial on Web Scraping with Selenium in Python.

    Enjoyed This Post?