4

Here is a MCVE:

/.travis.yml:

language: python
python:
  - "3.5"
dist: trusty
addons:
  chrome: stable
before_install:
  - pip install selenium
  - wget https://chromedriver.storage.googleapis.com/2.35/chromedriver_linux64.zip
  - unzip chromedriver_linux64.zip -d test/driver/
before_script:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"
  - sleep 3
script:
  - cd test
  - python3 ./test_main.py

/test/test_main.py:

from selenium.webdriver import *
b=Chrome('driver/chromedriver')
b.get('http://example.com')
b.quit()

The build will fail, raising an exception saying that chrome is crashed:

$ python3 ./test_main.py
Traceback (most recent call last):
  File "./test_main.py", line 2, in <module>
    b=Chrome('driver/chromedriver')
  File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/selenium/webdriver/chrome/webdriver.py", line 75, in __init__
    desired_capabilities=desired_capabilities)
  File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 154, in __init__
    self.start_session(desired_capabilities, browser_profile)
  File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 243, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
    self.error_handler.check_response(response)
  File "/home/travis/virtualenv/python3.5.4/lib/python3.5/site-packages/selenium/webdriver/remote/errorhandler.py", line 237, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Chrome failed to start: crashed
  (Driver info: chromedriver=2.35.528139 (47ead77cb35ad2a9a83248b292151462a66cd881),platform=Linux 4.14.12-041412-generic x86_64)

The code above used to work several days ago, so I am wondering if it is a bug in the travis build environment.

xmcp
  • 3,347
  • 2
  • 23
  • 36
  • Possible duplicate of [unknown error: chrome failed to start](https://stackoverflow.com/questions/47142311/unknown-error-chrome-failed-to-start) – undetected Selenium Jan 15 '18 at 13:07

1 Answers1

6

https://github.com/travis-ci/travis-ci/issues/8836

According to the support team:

It seems something changed with the Chrome version we are installing on our container-based infrastructure. We are still looking into the contributing factors and we will hopefully come up with a fix soon.

In the meantime, a workaround is to route your builds to our sudo-enabled infrastructure by adding the following to your .travis.yml file:

sudo: required
addons:
  chrome: stable
Community
  • 1
  • 1
xmcp
  • 3,347
  • 2
  • 23
  • 36