2
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

「Cannot call non W3C standard command while in W3C mode」を解決する

Posted at

chromeとchromedriverを最新の75にアップデートしたら、capybaraのfeature specで以下のエラーが出るようになりました。

     Failure/Error: Unable to infer file and line number from backtrace

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

・・・なんのこっちゃい :innocent:

調べてみると、v75からW3CモードがデフォルトONになったそうです :point_down:

The most noticeable change is ChromeDriver now runs in W3C standard compliant mode by default. Other changes include:
Downloads - ChromeDriver - WebDriver for Chrome

解決策

今回、chromedriverのオプションにw3c: falseを追加することで解決できました。

spec/support/capybara.rb
Capybara.register_driver :headless_chrome do |app|
  capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
    chromeOptions: {
      args: %w[headless disable-gpu window-size=1680,1050],
      w3c: false
    }
  )
  Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: capabilities)
end

以上です :hugging:

参考

2
3
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
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?