lundi 27 août 2018

Firefox is default but still get WebDriverError: unable to connect to chromedriver 127.0.0.1:9515

I'm setting up Capybara for the first time and it seems to be calling Chrome instead of Firefox by default.

At first I was getting the webdriver error:

Selenium::WebDriver::Error::WebDriverError: unable to connect to chromedriver 127.0.0.1:9515* with associated stacktrace
https://pastebin.com/TW5NWJgu

I was able to clear this by adding a gem 'chromedriver-helper' and the test now opens with chromium.

I also tried adding this to both spec_helper and rails_helper:

Capybara.register_driver :selenium do |app|
  Capybara::Selenium::Driver.new(app, browser: :firefox)
end

I was able to confirm that rails was able to successfully call firefox because the following command in rails_helper does successfully launch Firefox (but does not take any further action) when I start the test (as per comments, I later removed this command).

RSpec.configure do |config|
    driver = Selenium::WebDriver.for :firefox
end

I'm getting the same error on a separate machine and on a different rails app (also didn't have geckodriver set-up on the first pass of Capybara)

My understanding is that Capybara should call Firefox by default. There seems to be a second configuration somewhere that I can't find. Does anyone have an idea of where I might find the line that is calling chrome?

Aucun commentaire:

Enregistrer un commentaire