特拉维斯:无法找到chromedriver

时间:2017-02-13 17:48:42

标签: ruby continuous-integration cucumber travis-ci

我正在尝试使用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

的路径,在我的本地Windows机器中修复了此问题

我不确定如何在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

2 个答案:

答案 0 :(得分:1)

最后,能够让travis运行我的黄瓜测试。

我做的改变

  1. 为用于显示Not permitted
  2. 的权限更改提供了sudo
  3. 将Chromedriver版本从2.7降级为2.27
  4. 这些修好了

    当前.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 docsthis 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-stablebefore_install - addons - chromestable值。

也许对某人有所帮助。