Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: Capyabra / Selenium Chrome-Driver Settings

I have my Rails-App set up with Capybara. Tests are working fine but I'm getting this error:

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 (with or without the disabled lines makes no difference)

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

Any ideas?

like image 913
chmich Avatar asked May 03 '19 13:05

chmich


People also ask

Which of the following tools supports headless browser driver with JavaScript in capybara?

Capybara-webkit driver (a gem) is used for true headless browser testing with JavaScript support. It uses QtWebKit and it is significantly faster than Selenium as it does not load the entire browser.


Video Answer


1 Answers

this worked for me. Since the gem is deprecated, I just uninstalled the gem

 gem uninstall chromedriver-helper

then remove it from your gem file and run:

bundle update

after that, add the webdriver gem in-place, and bundle install

gem 'webdrivers', '~> 4.0'

bundle install

the warnings should be gone

like image 135
Victor Okeugo Avatar answered Oct 16 '22 12:10

Victor Okeugo