1

I have resolved this issue but still want to post as a QA.

#My code 
# import web driver
from selenium import webdriver
from selenium.webdriver.chrome.service import Service

# specifies the path to the chromedriver.exe
s = Service('/chromedriver.exe')

driver = webdriver.Chrome(service=s)

# driver.get method() will navigate to a page given by the URL address
driver.get('https://www.google.com')

error : WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://chromedriver.chromium.org/home

Amirgiano
  • 69
  • 6
  • if your Chrome webdriver is in the same path as your python script, remove the `/` from your path, i.e. `s = Service('chromedriver.exe')`, otherwise, that path needs to be the full explicit path to the executable, e.g. `C:/Users/Me/Downloads/ChromeDriver/chromedriver.exe` – chickity china chinese chicken Dec 04 '21 at 20:47

1 Answers1

-1
  1. Check where is your Path?
import sys
print(sys.path)

Add the file in your path and run the code.

Amirgiano
  • 69
  • 6
  • `sys.path` is the Python path, i.e. the path Python searches when importing modules. That's entirely separate from the [system path](https://en.wikipedia.org/wiki/PATH_(variable)), which is what's relevant to the OS when searching for executables. – Brian61354270 Dec 04 '21 at 21:01