2022-02-06 Capybara::Selenium::Driverのoptions属性のdeprecaton
Capybara::Selenium::Driverのoptions属性のdeprecaton
rspec を回しているとこんなエラーメッセージを発見。
WARN Selenium [DEPRECATION] [:browser_options] :options as a parameter for driver initialization is deprecated. Use :capabilities with an Array of value capabilities/options if necessary instead.
capybara + seleniumの設定でdesired_capabilities/options属性がDEPRECATIONになった - Qiita
こんな感じでoptionsをcapabilitiesに置き換えてやればOK。
Capybara.register_driver :headless_chrome do |app|
browser_options = ::Selenium::WebDriver::Chrome::Options.new.tap do |opts|
opts.args << "--headless"
opts.args << "--disable-gpu"
opts.args << "--no-sandbox"
end
- Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
+ Capybara::Selenium::Driver.new(app, browser: :chrome, capabilities: browser_options)
end
参考PR: Fix Selenium deprecation message: options → capabilities by toshimaru