1

Hell, so I am running widows 10 with the latest webdriver in selenium python 3.7. I've had this code work on another machine but when I use it on my new laptop I get the error in the title. I have the driver in my path in multiple places and I specify it in my code, but I have no idea why I am getting this error. My code line below:

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("--incognito")
browser = webdriver.Chrome(executable_path=r'C:\WebDrivers\chromedriver\chromedriver.exe', chrome_options=chrome_options)

Any help on this would be great. I read the other solutions for this and they did not seem to work at all for me

1 Answers1

0

Instead of configuring the chrome driver manually.You can use webdriver-manager, this will automatically download and set the path of the driver location.

You can get it from pip,

pip install webdriver-manager

Now you simply call ChromeDriverManager().install() to do it automatically. Instead of worrying about the path.

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("--incognito")
browser = webdriver.Chrome(executable_path=ChromeDriverManager().install(), chrome_options=chrome_options)
Navarasu
  • 8,209
  • 2
  • 21
  • 32