我正在努力为我的 Rails rspec 系统测试更新 selenium / webdrivers。我曾经有 webdriver gem,现在它告诉我我需要使用 selenium-webdriver。我已经安装了那个 gem,根据 Gemfile.lock 它是 v 4.12.0,应该是最新的。
rspec/rails_helper.rb 中的以下配置会产生如下错误:
Failure/Error:
def create_bridge(caps:, url:, http_client: nil)
Remote::Bridge.new(http_client: http_client, url: url).tap do |bridge|
bridge.create_session(caps)
end
end
ArgumentError:
unknown keyword: :capabilities
rails_helper.rb中的配置:
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
end
Capybara.register_driver :headless_chrome do |app|
options = Selenium::WebDriver::Remote::Options.chrome(
'goog:chromeOptions': { args: %w(window-size=1400,1400) }
)
Capybara::Selenium::Driver.new app, browser: :chrome, options:
end
有什么提示吗?我尝试摆弄“desired_capability”,但这并没有改变任何东西。
selenium-webdriver gem 在 4.12.0
版本中有
changes,影响了功能关键字:
4.12.0 (2023-08-31)
=========================
Ruby:
* Fix bug preventing good error messages in Selenium Manager when stdout empty
* Fix bug with Firefox not loading net/http library by default (#12506)
* Remove support for using capabilities in local drivers
BiDi:
* Released selenium-devtools 0.116.0 (supports CDP v85, v114, v115, v116)