Home >Backend Development >Python Tutorial >Selenium WebDriver Error: Why Can't I Obtain a Driver with Selenium Manager?
When attempting to utilize Selenium Webdriver, a common error encountered is the inability to obtain a driver due to two exceptions:
Code Snippet:
from selenium import webdriver chrome_driver_path = <chrome drive .exe path> driver = webdriver.Chrome(chrome_driver_path)
Cause:
This error typically occurs when using Selenium version 4.6.0 or higher, where Selenium Manager attempts to retrieve the driver. However, in the given code, the driver path is explicitly set, which clashes with Selenium Manager.
Solution:
If Selenium version 4.6.0 or greater is being used, it is no longer necessary to set the driver path manually. Selenium Manager will handle the browser and drivers automatically.
Simplified Code:
from selenium import webdriver driver = webdriver.Chrome() driver.get("https://www.google.com/") driver.quit()
References:
The above is the detailed content of Selenium WebDriver Error: Why Can't I Obtain a Driver with Selenium Manager?. For more information, please follow other related articles on the PHP Chinese website!