我正在尝试使用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.
(硒::的webdriver ::错误:: WebDriverError)
我通过在chromedriver
的{{1}}文件夹中添加lib
并添加ruby
我不确定如何在system32, webem
中解决这个问题。有人能帮助我吗?
我的.travis.yml文件看起来像这样
Travis
我已将以下代码添加到现有的.yml
中插件: 易于: 包: - 铬浏览器 - 铬 - 氯化物
rvm:2.2
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
我现在得到的错误是
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
答案 0 :(得分:1)
最后,能够让travis运行我的黄瓜测试。
我做的改变
Not permitted
2.7
降级为2.27
这些修好了
当前.travis.yml
文件如下所示
sudo: required
language: ruby
dist: trusty
addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable
script: bundle exec cucumber
before_script:
- bundle install
- gem install watir
- gem install colorize
- gem install rspec
- gem install cucumber
- gem install rake
- gem install chromium
- wget http://chromedriver.storage.googleapis.com/2.27/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip
- sudo apt-get install libnss3
- sudo apt-get --only-upgrade install google-chrome-stable
- sudo cp chromedriver /usr/local/bin/.
- sudo chmod +x /usr/local/bin/chromedriver
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sleep 3
branches:
only:
- master
notifications:
email:
- iamsmj@gmail.com
答案 1 :(得分:0)
我为自己尝试了你的解决方案,因为我遇到了同样的错误,但它没有成功。在结合the docs和this SO后,我最终得到了这个设置:
$ gcc -O3 -g -std=c11 -Wall -Wextra -Werror -Wmissing-prototypes \
> -Wstrict-prototypes pw89.c -o pw89
$
重要的步骤是:
dist: trusty
language: ruby
sudo: required
before_install:
- gem install bundler
- "rm ${BUNDLE_GEMFILE}.lock"
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 http://localhost &
cache: bundler
rvm:
- 2.4.0
env:
- DB=pgsql
services:
- postgresql
test:
adapter: postgresql
database: app_test
addons:
chrome: stable
# uncomment and edit the following line if your project needs to run something other than `rake`:
# script:
# - bundle exec rspec spec
before_script:
- cp config/database.yml.travis config/database.yml
- psql -c 'create database app_test;' -U postgres
- bundle update
- bundle exec rake db:test:prepare
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sleep 3
deploy:
provider: heroku
api_key:
secure: "api_ley"
app: awesome-development-app
notifications:
slack: app:key
中的google-chrome-stable
,before_install
- addons
- chrome
和stable
值。
也许对某人有所帮助。