Search code examples
pythonselenium-webdriverwebdriver-managerwebdrivermanager-python

Does the python library 'webdriver-manager' always install the latest chrome driver?


Even reading the github page, the role of this library is confusing.

  1. always install the latest chrome drivers
  2. checks the user's Chrome browser version and installs the appropriate Chrome driver.

Which is it?


Solution

  • Yes, it installs the latest version.

    https://pypi.org/project/webdriver-manager/

    An excerpt from doc:

    Before: You need to download the chromedriver binary, unzip it somewhere on your PC and set the path to this driver like this:

    from selenium import webdriver
    driver = webdriver.Chrome('/home/user/drivers/chromedriver')
    

    It’s boring!!! Moreover, every time a new version of the driver is released, you need to repeat all these steps again and again.


    With webdriver manager, you just need to do two simple steps:

    Install manager:

    pip install webdriver-manager
    

    Use with Chrome

    # selenium 3
    from selenium import webdriver
    from webdriver_manager.chrome import ChromeDriverManager
    
    driver = webdriver.Chrome(ChromeDriverManager().install())
    

    To install your desired version there is an option for version:

    Specify the version of webdriver you need. And webdriver-manager will download it from sources for your os.

    from webdriver_manager.chrome import ChromeDriverManager
    
    ChromeDriverManager(driver_version="2.26").install()