0

Windows 10 and using Windows Subsystem for Linux. I have installed the chromedriver for Windows from the official website. The version of Chrome matches the version of the chromedriver. I'm trying to webscrape with Selenium and when using this piece of code:

driver = webdriver.Chrome(executable_path=r'C:\Users\Tyrone\Desktop\data\chromedriver.exe')

I get

selenium.common.exceptions.WebDriverException: Message: 'C:\Users\Tyrone\Desktop\data\chromedriver.exe' executable needs to be in PATH. 

Using this code from another thread (selenium - chromedriver executable needs to be in PATH)

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(ChromeDriverManager().install())

Results in this error message:

/bin/sh: 1: google-chrome: not found
Traceback (most recent call last):
  File "test.py", line 5, in <module>
    driver = webdriver.Chrome(ChromeDriverManager().install())
  File "/home/w/.local/lib/python3.6/site-packages/webdriver_manager/chrome.py", line 27, in install
    driver_path = self.download_driver(self.driver)
  File "/home/w/.local/lib/python3.6/site-packages/webdriver_manager/manager.py", line 32, in download_driver
    driver_version, is_latest = self.__get_version_to_download(driver)
  File "/home/w/.local/lib/python3.6/site-packages/webdriver_manager/manager.py", line 23, in __get_version_to_download
    return self.__get_latest_driver_version(driver), True
  File "/home/w/.local/lib/python3.6/site-packages/webdriver_manager/manager.py", line 17, in __get_latest_driver_version
    return driver.get_latest_release_version()
  File "/home/w/.local/lib/python3.6/site-packages/webdriver_manager/driver.py", line 58, in get_latest_release_version
    self._latest_release_url + '_' + chrome_version(self.chrome_type))
  File "/home/w/.local/lib/python3.6/site-packages/webdriver_manager/utils.py", line 110, in chrome_version
    .format(cmd)
ValueError: Could not get version for Chrome with this command: google-chrome --version

Any clue on what's happening?

1 Answers1

0

it seems like the chromedriver was not found in the path,

could you try placing chromedriver into the same path as the code runs and then use the following

driver = webdriver.Chrome('chromedriver.exe')
KunduK
  • 32,888
  • 5
  • 17
  • 41