【发布时间】:2017-02-13 17:48:42
【问题描述】:
我正在尝试使用 watir 将 travis 集成到我的黄瓜测试中。但是,现在,我似乎陷入了 chromedriver 的最后一个问题。我得到了错误
Unable to find chromedriver. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver.
(Selenium::WebDriver::Error::WebDriverError)
我通过在ruby 的lib 文件夹中添加chromedriver 并添加system32, webem 的路径,在我的本地Windows 机器中修复了这个问题
我不确定如何在Travis 中解决此问题。有人可以帮我吗?
我的 .travis.yml 文件如下所示
sudo: required
language: ruby
cache: bundler
rvm: 2.2
before_script:
- bundle install
- gem install watir
- gem install colorize
- gem install rspec
- gem install cucumber
script: bundle exec cucumber
branches:
only:
- master
notifications:
email:
- iamsmj@gmail.com
我已将以下代码添加到现有的 .yml 中
插件: 易于: 包: - 铬浏览器 - 铬铬驱动程序
rvm:2.2
before_script:
- bundle install
- gem install watir
- gem install colorize
- gem install rspec
- gem install cucumber
- wget http://chromedriver.storage.googleapis.com/2.21/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- sudo chmod u+x chromedriver
- sudo mv chromedriver /usr/bin/
- export CHROME_BIN=chromium-browser
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3
- ./travis_before_install
我现在得到的错误是
--2017-02-13 18:04:46-- http://chromedriver.storage.googleapis.com/2.21/chromedriver_linux64.zip
Resolving chromedriver.storage.googleapis.com (chromedriver.storage.googleapis.com)... 64.233.191.128, 2607:f8b0:4001:c0c::80
Connecting to chromedriver.storage.googleapis.com (chromedriver.storage.googleapis.com)|64.233.191.128|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2692616 (2.6M) [application/zip]
Saving to: `chromedriver_linux64.zip'
0% [ ] 0 --.-K/s 100%[======================================>] 2,692,616 --.-K/s in 0.009s
wget: unable to resolve host address `.'
FINISHED --2017-02-13 18:04:48--
Total wall clock time: 1.5s
Downloaded: 1 files, 2.6M in 0.009s (281 MB/s)
The command "wget http://chromedriver.storage.googleapis.com/2.21/chromedriver_linux64.zip - unzip chromedriver_linux64.zip - sudo chmod u+x chromedriver - sudo mv chromedriver /usr/bin/ - export CHROME_BIN=chromium-browser - "export DISPLAY=:99.0" - "sh -e /etc/init.d/xvfb start" - sleep 3 - ./travis_before_install" failed and exited with 4 during .
Your build has been stopped.
Also, Could someone please let me know, why travis wouldnt run this?
`The command "bundle exec cucumber" exited with 2.`
UPDATE: I updated the file fixing the indentation in the `before_script` . The latest error i get is
0.08s$ unzip chromedriver_linux64.zip
Archive: chromedriver_linux64.zip
inflating: chromedriver
before_script.10
0.01s$ sudo chmod u+x chromedriver
before_script.11
0.01s$ sudo mv chromedriver /usr/bin/
before_script.12
0.00s$ export CHROME_BIN=chromium-browser
before_script.13
0.00s$ export DISPLAY=:99.0
before_script.14
0.01s$ sh -e /etc/init.d/xvfb start
Starting virtual X frame buffer: Xvfb.
before_script.15
3.01s$ sleep 3
2.55s$ bundle exec cucumber
end of file reached (EOFError)
The command "bundle exec cucumber" exited with 2.
Done. Your build exited with 1.
**Update:** I tried fixing up the identation errors in the script as. The new error i get is
0% [ ] 0 --.-K/s 100%[======================================>] 2,692,616 --.-K/s in 0.01s
2017-02-14 11:00:45 (173 MB/s) - ‘chromedriver_linux64.zip’ saved [2692616/2692616]
before_script.9
0.08s$ unzip chromedriver_linux64.zip
Archive: chromedriver_linux64.zip
inflating: chromedriver
before_script.10
0.01s$ sudo chmod u+x chromedriver
before_script.11
0.01s$ sudo mv chromedriver /usr/bin/
before_script.12
0.00s$ export CHROME_BIN=chromium-browser
before_script.13
0.00s$ export DISPLAY=:99.0
before_script.14
0.01s$ sh -e /etc/init.d/xvfb start
Starting virtual X frame buffer: Xvfb.
before_script.15
3.01s$ sleep 3
2.55s$ bundle exec cucumber
**end of file reached (EOFError)**
The command "bundle exec cucumber" exited with 2.
Done. Your build exited with 1.
【问题讨论】:
-
您是否尝试在脚本中明确设置?
Selenium::WebDriver::Chrome::Service.executable_path = '/usr/bin/chromedriver' -
@Raphael 不!没有!你能告诉我我在哪里必须提到这段代码吗?是在
before_script吗? -
@Raphael : 这是原始日志api.travis-ci.org/jobs/201230860/log.txt?deansi=true
-
能否修复
before_script阶段的缩进并再次运行构建? -
好的! @joepd:现在有一些进展。我已经更新了我的问题。请看一下
标签: ruby continuous-integration cucumber travis-ci