0

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?

2 Answers2

1

This error message...

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

...implies that an incorrect keyword was passed to install().

You saw it right. The key path=install_path is now removed from the current webdriver-manager release of version v4.0.0.


Solution

You can upgrade to latest release of Selenium v4.11.2 as you won't need to explicitly download ChromeDriver, GeckoDriver or any browser drivers as such using webdriver_manager. You just need to ensure that the desired browser client i.e. , or is installed.

Selenium Manager is the new tool integrated with that would help to get a working environment to run Selenium out of the box. Beta 1 of Selenium Manager will configure the browser drivers for Chrome, Firefox, and Edge if they are not present on the PATH.


Solution

As a solution you can simply do:

from selenium import webdriver

driver = webdriver.Chrome()
driver.get("https://www.google.com/")

References

Some useful lins and documentations:

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • I didn't know that the latest version of Selenium has such a feature. It was helpful. In my case, I needed to use Selenium3, so I chose another answer as the best answer. thank you very much. – daiki mamiya Aug 11 '23 at 23:51
0

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()))
ammar alkotb
  • 194
  • 6