0

I am trying to run a script (Python3.5), but get the error 'chromedriver' executable needs to be in PATH. I know I can change the PATH variable, but I wanted to use an absolute path. I went to the documentation https://sites.google.com/a/chromium.org/chromedriver/getting-started

The code example they used:

import time
from selenium import webdriver

driver = webdriver.Chrome('/path/to/chromedriver') #Optional argument, if     not specified will search path.

My code:

#!/usr/bin/env python3.5
from pyvirtualdisplay import Display
from selenium import webdriver

display = Display(visible=0, size=(800, 600))
display.start()
driver=webdriver.Chrome(
"/home/ubuntu/Downloads/chromedriver")
driver.get('https://python.org')
print (driver.title)

Any suggestions for why the absolute path is not working?

Solved the issue. I needed to added: executable_path, so driver = webdriver.Chrome(executable_path="home/ubuntu/Downloads/chromedriver") and now it runs fine.

Jahmul14
  • 329
  • 4
  • 18
  • absolute path works fine for me. what error are you getting? – Corey Goldberg Mar 29 '17 at 16:52
  • @Corey Goldberg: This is the traceback error I get: File "/home/ubuntu/virtenv/scrapeit/lib/python3.5/site-packages/selenium/webdr iver/common/service.py", line 81, in start os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'chromdriver' executable needs to be in PATH. – Jahmul14 Mar 29 '17 at 18:57
  • execute on terminal: `sudo chmod +x home/ubuntu/Downloads/chromedriver`, also check the name `chromdriver` – eyllanesc Mar 29 '17 at 19:39

0 Answers0