On running this code
from selenium import webdriver
driver = webdriver.Chrome("/usr/bin/google-chrome")
exits with this error after opening a browser with a new tab
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/chrome/webdriver.py", line 68, in __init__
self.service.start()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/common/service.py", line 96, in start
self.assert_process_still_running()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
% (self.path, return_code)
selenium.common.exceptions.WebDriverException: Message: Service /usr/bin/google-chrome unexpectedly exited. Status code was: 0
and after that I am unable to use the driver variable as it returns a NameError.
I installed selenium with pip and I am using python 3.5.3.
Edit 1:
I forgot to mention that i am using Ubuntu 17.04 zesty
While you are using
Selenium 3.x.xalong with the recentGoogle Chromebrowsers, you have to downloadchromedriver.exefrom this location place it in your system and mention the absolute location of thechromedriverbinary through the argumentexecutable_pathas follows: