I have tried many of the solutions given on stackoverflow but none of them have worked.
I want to open google chrome in selenium using python using an ubuntu shell on windows, however whenever I do I get an error. Terminal where I run the code as well as the folder path
I have tried to do this by specifying the path in the webdriver.Chrome function like so,
webdriver.Chrome('/path/to/chromedriver.exe')
but the same error keeps happening,
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/common/service.py", line 76, in start
stdin=PIPE)
File "/usr/lib/python3.5/subprocess.py", line 947, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/vinve/Desktop/chromedriver_win32/chromedriver.exe'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/common/service.py", line 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver.exe' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
I have tried typing the path using double slashes and as a raw string but nothing works.
I also added to chromedriver.exe file to the scripts folder but that didn't help. I also ran the path like so webdriver.Chrome(/path/to/chromedriver) without the .exe and that didnt work. I also tried running it with chrome_options in the --headless mode but that didnt work. (all these options gave the same error above)
EDIT: ANSWER: I figured it out! it was the fact that although I was on windows 10, I was using Windows Subsystem for Linux (Ubuntu shell). So the path that is specified in the webdriver.Chrome(/path/to/chromedriver.exe) should not begin with C:/path/to/driver.exe rather is should be /mnt/c/Users/path/to/chromedriver.exe