LoginSignup
2
1

More than 5 years have passed since last update.

RSpecを起動ようとしたら、「unknown command: Cannot call non W3C standard command while in W3C mode」と言われて怒られた

Posted at

導入

以下の書籍を読みながら、RSpecについて学んでいます。

現場で使える Ruby on Rails 5速習実践ガイド

写経しながら、RSpecでテストコードを書いて、いざはじめてのRSpecと思って、
ワクワクしながらコマンドを叩くと、以下のエラーが出た。

Selenium::WebDriver::Error::UnknownCommandError:
       unknown command: Cannot call non W3C standard command while in W3C mode

Google Chromeとchromedriverのバージョンを最新の75にアップデートしたことで、W3CモードがデフォルトONになったみたい。

解決策

オプションに「w3c:false」を渡してやると、うまく解決が出来た。
自分の場合はオプションの設定方法が分からなくてハマったけど、何とかテストコードが動いて、
All Greenになった!

RSpec.configure do |config|

  config.before(:each, type: :system) do
    # 修正前
    driven_by :selenium_chrome_headless

    # 修正後
    caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => {"w3c" => false})
    driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400], options: { desired_capabilities: caps }
  end

参考にしたURL

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1