我有我的 Rails-App
设置 Capybara
.测试工作正常,但我收到此错误:
2019-05-03 14:51:58 WARN Selenium [DEPRECATION] Selenium::WebDriver::Chrome#driver_path= is deprecated. Use Selenium::WebDriver::Chrome::Service#driver_path= instead.
Gemfile
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of chromedriver to run system tests with Chrome
gem 'chromedriver-helper'
end
test_helper.rb
(有无禁用线没有区别)
ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'capybara/rspec'
require 'rspec/rails'
require 'capybara/rails'
RSpec.configure do |config|
# Capybara.register_driver :chrome do |app|
# Capybara::Selenium::Driver.new app, browser: :chrome,
# options: Selenium::WebDriver::Chrome::Options.new(args: %w[headless disable-gpu])
# end
# Capybara.javascript_driver = :chrome
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
config.shared_context_metadata_behavior = :apply_to_host_groups
Kernel.srand config.seed
end
有任何想法吗?
最佳答案
这不是错误,而是弃用警告。
gem chromedriver-helper
是 deprecated
NOTICE: This gem is out of support as of 2019-03-31 Please use https://github.com/titusfortner/webdrivers instead. See https://github.com/flavorjones/chromedriver-helper/issues/83 for details.
在你的 gemfile 中:
group :test do
gem 'webdrivers', '~> 3.0'
end
group :development, :test do
gem 'capybara'
end
我会建议您将 capybara 移到开发和测试组中,并在可能的情况下对其进行更新。
关于ruby-on-rails - rails : Capyabra/Selenium Chrome-Driver Settings,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55970418/