1

I keep getting this error:

Traceback (most recent call last):
  File "C:/Users/LENOVO/Desktop/Coding -Winson/PyCharm/opening_webs.py", line 3, in <module>
    driver = webdriver.Chrome('/path/to/chromedriver')
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
    self.service.start()
  File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Every time I use this code:

from selenium import webdriver

webdriver.Chrome(executable_path= "Users\LENOVO\AppData\Local\Programs\Python\Python38-32\chromedriver.exe")
Cris Luengo
  • 55,762
  • 10
  • 62
  • 120
  • you need to use double \ for paths in python. ie. ```webdriver.Chrome(executable_path= "Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python38-32\\chromedriver.exe")``` – ewokx Aug 05 '20 at 06:47
  • How is this related to MATLAB? Please use tags that describe what the question is about, and don't include irrelevant tags. – Cris Luengo Aug 05 '20 at 07:05
  • The error message says "Please see https://sites.google.com/a/chromium.org/chromedriver/home". Did you do so? – Cris Luengo Aug 05 '20 at 07:06

1 Answers1

1

try this

webdriver.Chrome(executable_path= r"C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Python\\Python38-32\\chromedriver.exe")

And make sure you have chrome driver there

or it will still show up this error

Traceback (most recent call last): File "C:/Users/LENOVO/Desktop/Coding -Winson/PyCharm/opening_webs.py", line 3, in driver = webdriver.Chrome('/path/to/chromedriver') File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in init self.service.start() File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start raise WebDriverException( selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home

If the problem still persists try putting a copy of chrome executable in the current path where your python program is located

Sashank
  • 557
  • 6
  • 20