pythonselenium-webdriverselenium-chromedriverwebdriver-manager

i can't install the driver in the location specified by python's webdriver-manager


When I updated webdriver-manager to the latest version (4.0.0), I couldn't install it to the specified location that I could do before.

・before selenium==3.141.0 webdriver-manager==2.5.2

install_path = 'My custom path'
driver = webdriver.Chrome(ChromeDriverManager(path=install_path).install())

Previously it was working fine in this environment. However, after updating webdriver-manager to 4.0.0, the following error occurred.

Traceback (most recent call last):
    driver = webdriver.Chrome(ChromeDriverManager().install(path=install_path))
TypeError: install() got an unexpected keyword argument 'path'

It seems that the argument (path) that could be specified before has disappeared. It's not even mentioned in the documentation (https://github.com/SergeyPirogov/webdriver_manager).

How can I specify where to install the driver?


Solution

  • from following issue you should replace old with:

    from selenium import webdriver
    from selenium.webdriver.chrome.service import Service as ChromeService
    from webdriver_manager.chrome import ChromeDriverManager
    from webdriver_manager.core.driver_cache import DriverCacheManager
    
    install_path = 'My custom path'
    cache_manager=DriverCacheManager(install_path )
    driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager(cache_manager=cache_manager).install()))