0

Rails 3.2 アプリがあります。Google chrome を使用してキュウリ テストを実行するように設定しようとしています。同じ設定を追加しました:

Capybara.register_driver :selenium do |app|
  Capybara::Selenium::Driver.new(app, :browser => :chrome)
end

また、 /usr/bin/ にバイナリを含む chromedriver をインストールしました。

➜  ~  ls -lah /usr/bin | grep chrome
-rwxrwxrwx  1 root   root     18M May 20 15:42 chromedriver
lrwxrwxrwx  1 root   root      32 Apr  6 10:19 google-chrome -> /opt/google/chrome/google-chrome

google.com を開いて何かを検索する単純な機能を実行しようとすると、次のエラーが発生します。

unexpected response, code=404, content-type=""
      unknown command: session/url (Selenium::WebDriver::Error::WebDriverError)
      ./features/step_definitions/google_steps.rb:2:in `/^I am on the google page$/'
      features/google.feature:3:in `Given I am on the google page'

残りのトレース:

unexpected response, code=404, content-type=""
      unknown command: session/url (Selenium::WebDriver::Error::WebDriverError)
      /home/arkiver/.rvm/gems/ruby-1.9.3-p392@tests/gems/selenium-webdriver-2.32.1/lib/selenium/webdriver/remote/http/common.rb:66:in `create_response'
      /home/arkiver/.rvm/gems/ruby-1.9.3-p392@tests/gems/selenium-webdriver-2.32.1/lib/selenium/webdriver/remote/http/default.rb:66:in `request'
      /home/arkiver/.rvm/gems/ruby-1.9.3-p392@tests/gems/selenium-webdriver-2.32.1/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
      /home/arkiver/.rvm/gems/ruby-1.9.3-p392@tests/gems/selenium-webdriver-2.32.1/lib/selenium/webdriver/remote/bridge.rb:619:in `raw_execute'
      /home/arkiver/.rvm/gems/ruby-1.9.3-p392@tests/gems/selenium-webdriver-2.32.1/lib/selenium/webdriver/remote/bridge.rb:597:in `execute'
      /home/arkiver/.rvm/gems/ruby-1.9.3-p392@tests/gems/selenium-webdriver-2.32.1/lib/selenium/webdriver/remote/bridge.rb:103:in `get'
      /home/arkiver/.rvm/gems/ruby-1.9.3-p392@tests/gems/selenium-webdriver-2.32.1/lib/selenium/webdriver/common/navigation.rb:14:in `to'
      /home/arkiver/.rvm/gems/ruby-1.9.3-p392@tests/gems/capybara-2.1.0/lib/capybara/selenium/driver.rb:90:in `reset!'
      /home/arkiver/.rvm/gems/ruby-1.9.3-p392@tests/gems/capybara-2.1.0/lib/capybara/session.rb:77:in `reset!'
      /home/arkiver/.rvm/gems/ruby-1.9.3-p392@tests/gems/capybara-2.1.0/lib/capybara.rb:245:in `block in reset_sessions!'
      /home/arkiver/.rvm/gems/ruby-1.9.3-p392@tests/gems/capybara-2.1.0/lib/capybara.rb:245:in `each'
      /home/arkiver/.rvm/gems/ruby-1.9.3-p392@tests/gems/capybara-2.1.0/lib/capybara.rb:245:in `reset_sessions!'
      /home/arkiver/.rvm/gems/ruby-1.9.3-p392@tests/gems/capybara-2.1.0/lib/capybara/cucumber.rb:10:in `After'

ここで何が欠けているのかを理解するのに助けが必要です。

4

2 に答える 2

0

私も同じ問題を抱えていました。私の場合、最新のドライバーを使用していましたが、使用していたセレン gem も最新バージョンに更新する必要がありました。

于 2013-08-17T20:48:33.337 に答える
0

この問題を修正しました。私は (誤って?) 間違ったバージョンのドライバーを使用していました:

https://code.google.com/p/chromedriver/downloads/listから、このバージョンをダウンロードしました:

「 chromedriver_linux64_26.0.1383.0.zip linux64 用 ChromeDriver サーバー」

以前に選択した代わりに:

" chromedriver2_linux64_0.8.zip バージョンの ChromeDriver2 r195627 リリース "

それはそれを修正しました。

于 2013-05-20T13:24:56.103 に答える