I am trying to set up chrome webdriver in ubuntu. I already did
pip install selenium
and I can do
from selenium import webdriver
To install chrome webdriver, I have tried many things. For example, I tired an answer from Can't use chrome driver for Selenium Here, I tried
- Check you have installed latest version of chrome browser-> "chromium-browser -version"
- If not, install latest version of chrome "sudo apt-get install chromium-browser"
- Get the appropriate version of chrome driver from http://chromedriver.storage.googleapis.com/index.html
- Unzip the chromedriver.zip
- Move the file to /usr/bin directory sudo mv chromedriver /usr/bin
- Goto /usr/bin directory and you would need to run something like "chmod a+x chromedriver" to mark it executable.
- finally you can execute the code.
According to it, I could do
from selenium import webdriver
driver = webdriver.Chrome()
However, in the second line I am getting the error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/../.local/lib/python2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 81, in __init__
desired_capabilities=desired_capabilities)
File "/home/../.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
self.start_session(capabilities, browser_profile)
File "/home/../.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "/home/../.local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/home/../.local/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac),platform=Linux 4.15.0-109-generic x86_64)
Can anyone help me?