Can't open webdriver selenium easy in digital ocean server

January 10, 2019 466 views
Python Ubuntu 16.04

easy code not work selenium

#!/usr/bin/python
# This Python file uses the following encoding: utf-8

import time
import random
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.chrome.options import Options 
from pyvirtualdisplay import Display


driver = webdriver.Chrome(executable_path='/usr/bin/chromedriver')

link = "https://google.com"
driver.get(link)
driver.save_screenshot('/var/chromedriver/headless_chrome_test.png') 
driver.quit()

have mistake console


Traceback (most recent call last):
  File "follow.py", line 27, in <module>
    driver = webdriver.Chrome(executable_path='/usr/bin/chromedriver')
  File "/var/venv/lib/python3.5/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    desired_capabilities=desired_capabilities)
  File "/var/venv/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 92, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/var/venv/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 179, in start_session
    response = self.execute(Command.NEW_SESSION, capabilities)
  File "/var/venv/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "/var/venv/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, 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.9.248304,platform=Linux 4.4.0-140-generic x86_64)

1 Answer

Hey friend,

I found another person who experienced a similar error, and someone offered an answer that appeared to work for them:

https://stackoverflow.com/questions/47596402/selenium-chrome-failed-to-start-exited-abnormally-error

Jarland

Have another answer? Share your knowledge.