2015-12-02 149 views
1

我升級到El Capitan,然後問題開始了。當我運行cucumber features它提供了以下錯誤:無法加載mac os上的selenium-webdriver el capitan

Background: Member should open homepage # features/m001_top_header.feature:6 
Capybara's selenium driver is unable to load `selenium-webdriver`, please install the gem and add `gem 'selenium-webdriver'` to your Gemfile if you are using bundler. (LoadError) 
./features/support/env.rb:47:in `new' 
./features/support/env.rb:47:in `block in <top (required)>' 
./features/support/app_life_cycle_hooks.rb:22:in `Before' 
Capybara's selenium driver is unable to load `selenium-webdriver`, please install the gem and add `gem 'selenium-webdriver'` to your Gemfile if you are using bundler. (LoadError) 
./features/support/env.rb:47:in `new' 
./features/support/env.rb:47:in `block in <top (required)>' 
./features/support/app_life_cycle_hooks.rb:22:in `Before' 

當我運行bundle install然後selenium-webdriver安裝:

~/P/m/web-automation (responsive ⚡=) bundle install 
... 
Using websocket 1.2.2 
Using selenium-webdriver 2.48.1 
Using spec 5.3.4 
... 
Bundle complete! 13 Gemfile dependencies, 61 gems now installed. 
Use `bundle show [gemname]` to see where a bundled gem is installed. 
~/P/m/web-automation (responsive ⚡=) bundle show selenium-webdriver 
/usr/local/lib/ruby/gems/2.2.0/gems/selenium-webdriver-2.48.1 

但是當我檢查which selenium-webdriver,它沒有返回值:

~/P/m/web-automation (responsive ⚡=) which selenium-webdriver 
~/P/m/web-automation (responsive ⚡=) which rspec 
/usr/local/bin/rspec 
~/P/m/web-automation (responsive ⚡=) which ruby 
/usr/local/bin/ruby 
~/P/m/web-automation (responsive ⚡=) which selenium-webdriver 
~/P/m/web-automation (responsive ⚡=) 

我的紅寶石版本是:

~/P/m/web-automation (responsive ⚡=) ruby -v 
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin15] 

我想這個問題是關係到路徑和配置,因爲我可以要求selenium-webdriver IRB,但我想不出解決它。任何大師請幫我解決這個問題?

回答

0

五月有人需要這樣的解決方案。

多次試驗後,最終我找到了解決問題。首先版本rbenvruby是不同的,所以安裝與rbenv相同版本的紅寶石作爲ruby 2.0.0p645 (2015-04-13 revision 50299) [universal.x86_64-darwin15]。之後,再次安裝bundle,最後bundle install成功安裝了webkit和其他gem。

~/P/m/web-automation (responsive ⚡=) rbenv version 
2.0.0-p645 (set by /Users/mesutgunes/.rbenv/version) 
~/P/m/web-automation (responsive ⚡=) ruby -v 
ruby 2.0.0p645 (2015-04-13 revision 50299) [universal.x86_64-darwin15] 
~/P/m/web-automation (responsive ⚡=) bundle install 
Failed to execute process '/usr/local/bin/bundle'. Reason: 
The file '/usr/local/bin/bundle' specified the interpreter '/usr/local/opt/ruby/bin/ruby', which is not an executable command. 
~/P/m/web-automation (responsive ⚡=) 
~/P/m/web-automation (responsive ⚡=) 
~/P/m/web-automation (responsive ⚡=) gem install bundler 
Successfully installed bundler-1.10.6 
Parsing documentation for bundler-1.10.6 
1 gem installed 
~/P/m/web-automation (responsive ⚡=) bundle install 
1

嘗試運行

bundle exec cucumber 
+0

我需要使用黃瓜beacuse CI腳本依賴它。 –

+0

呵呵? bundle exec cucumber只是設置環境,以便使用Gemfile中指定的gem版本,然後在該環境中執行黃瓜。 –

+0

我知道它運行黃瓜,但我需要運行'黃瓜......' –

相關問題