Nikolay Lipovtsev
Nikolay Lipovtsev

Reputation: 677

Rails 5, Rspec-rails, Capybara, Selenium-webdriver - Unable to find Mozilla geckodriver

I try test my new gem, with use js. But got errors

app/spec/rails_helper.rb

require 'spec_helper'

...
require 'rspec/rails'
require 'capybara/rspec'
require 'capybara/rails'
require 'support/factory_bot'

app/spec/features/view_helper_spec.rb

require 'rails_helper'

RSpec.describe DynamicNestedForms::ViewHelpers do
  # it "does something" do
  it "displays patient" do
    patient = create(:patient)
    visit edit_patient_path(patient)

    expect(page).to have_selector("input[value='#{patient.name}']")
  end

  it "displays physicians", :js => true do
    patient = create(:patient)
    physician = create(:physician)
    visit edit_patient_path(patient)

    fill_in "autocomplete_nested_content", with: physician[0..2]

    expect(page).to have_selector(".ui-menu-item-wrapper", text: physician.name)
  end
end

I get this error:

Selenium::WebDriver::Error::WebDriverError:
        Unable to find Mozilla geckodriver. Please download the server from https://github.com/mozilla/geckodriver/releases and place it somewhere on your PATH. More info at https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver.

Upvotes: 2

Views: 952

Answers (1)

Thomas Walpole
Thomas Walpole

Reputation: 49870

The easiest solution to this is to add the webdrivers gem to your project which will automatically download/install the relevant driver program and inform selenium-webdriver of its location - https://github.com/titusfortner/webdrivers

Upvotes: 3

Related Questions