I
I
Ismail2020-04-30 20:48:26
Ruby on Rails
Ismail, 2020-04-30 20:48:26

Why is Selenium Webdriver (Rails) not seeing firefox?

Hello. I want to test the interface, and for some reason selenium thinks that "/usr/bin/firefox" is not a file.

rails_helper

require "spec_helper"

ENV["RAILS_ENV"] ||= "test"
require File.expand_path("../config/environment", __dir__)

abort("The Rails environment is running in production mode!") if Rails.env.production?
require "rspec/rails"
Dir[Rails.root.join("spec/support/**/*.rb")].sort.each { |f| require f }

require "capybara/rails"

require "selenium/webdriver"

Selenium::WebDriver::Firefox::Binary.path = "/usr/bin/firefox"

begin
  ActiveRecord::Migration.maintain_test_schema!
rescue ActiveRecord::PendingMigrationError => e
  puts e.to_s.strip
  exit 1
end

RSpec.configure do |config|
  config.fixture_path = "#{::Rails.root}/spec/fixtures"
  config.include FactoryBot::Syntax::Methods

  config.use_transactional_fixtures = true

  config.infer_spec_type_from_file_location!

  config.filter_rails_from_backtrace!
end



At the same time, it whichnormally gives out the path and sees firefox: Why is that?
which firefox #=> /usr/bin/firefox

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Karbivnichy, 2020-04-30
@hottabxp

Because:

[email protected]:~$ file /usr/bin/firefox
/usr/bin/firefox: symbolic link to ../lib/firefox/firefox.sh

Ruby I do not know, but most likely here:
Selenium::WebDriver::Firefox::Binary.path = "/usr/bin/firefox"

you need something like this:
Selenium::WebDriver::Firefox::Binary.path='/usr/bin/firefox/firefox-bin'

or where the binary is stored.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question