gpt4 book ai didi

selenium-webdriver - Chromedriver 在 Travis CI 上崩溃

转载 作者:行者123 更新时间:2023-12-05 00:13:40 25 4
gpt4 key购买 nike

这是一个 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()

构建将失败,引发一个异常,说 chrome 已崩溃:
$ 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)

上面的代码前几天还可以用,所以我想知道是不是travis构建环境的bug。

最佳答案

https://github.com/travis-ci/travis-ci/issues/8836
根据支持团队的说法:

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

关于selenium-webdriver - Chromedriver 在 Travis CI 上崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48236777/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com