Forums

Selenium with Headless Chrome crashing

This is the error I get:

Traceback (most recent call last):
  File "/home/ayudh37/reddit-tinker.py", line 115, in <module>
    browser = webdriver.Chrome(chrome_options=chrome_options)
  File "/usr/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    desired_capabilities=desired_capabilities)
  File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 90, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 177, in start_session
    response = self.execute(Command.NEW_SESSION, capabilities)
  File "/usr/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
    self.error_handler.check_response(response)
  File "/usr/lib/python3.7/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: crashed
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /usr/bin/chromium-browser is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
  (Driver info: chromedriver=2.42.591071 (0b695ff80972cc1a65a5cd643186d2ae582cd4ac),platform=Linux 4.4.0-1100-aws x86_64)

Any insight into the matter would be appreciated, thanks!

Can you give the code you used to run selenium?