ruby-on-rails - rails : Capyabra/Selenium Chrome-Driver Settings

标签 ruby-on-rails ruby selenium selenium-webdriver selenium-chromedriver

我有我的 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-helperdeprecated

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/

相关文章:

ruby-on-rails - 迁移后删除 Rails 模型

mysql - Aptana - 如何将默认值从 sqlite3 更改为使用 MySql?

ruby-on-rails - Puma 无法在 jRuby 上启动,错误为 : The signal USR1 is in use by the JVM and will not work correctly on this platform

ruby - RMagick 无法打开图像

python - ruby 中的 __repr__ 等价物是什么?

headless 模式的docker容器中的python selenium + geckodriver无法滚动页面

python - 尽管在 chrome inspect 中是正确的,但没有抓取正确的值

ruby-on-rails - 将适用于 SQLite 的查询转换为适用于 Postgres 的查询

ruby-on-rails - Rails - 按连接表数据排序

python - 如何为 Jupyter Notebook 安装 selenium?