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.
I forgot to mention that i am using Ubuntu 17.04 zesty
While you are using Selenium 3.x.x
along with the recent Google Chrome
browsers, you have to download chromedriver.exe
from this location place it in your system and mention the absolute location of the chromedriver
binary through the argument executable_path
as follows:
from selenium import webdriver
driver = webdriver.Chrome(executable_path='/usr/bin/chromedriver')
driver.get('https://www.google.co.in')
print("Page Title is : %s" %driver.title)
driver.quit()