heroku-buildpack-google-chrome
heroku-buildpack-google-chrome copied to clipboard
Selenium::WebDriver::Error::WebDriverError (Could not find Firefox binary (os=linux). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path=)
I'm really not understanding. Why this error is happing? I setted chrome as browser.
Selenium::WebDriver::Chrome.driver_path = "#{Rails.root.join('lib', 'chromedriver')}"
chrome_bin = ENV.fetch('GOOGLE_CHROME_SHIM', nil)
chrome_opts = chrome_bin ? { "chromeOptions" => { "binary" => chrome_bin } } : {}
Capybara.register_driver :chrome do |app|
Capybara::Selenium::Driver.new(
app,
:chrome,
desired_capabilities: Selenium::WebDriver::Remote::Capabilities.chrome(chrome_opts)
)
end
@session = Capybara::Session.new(:selenium)
@session.visit("https://www.google.com/")
When I run this code, I'm receiving this error:
2018-05-10T18:51:27.040801+00:00 app[web.1]: F, [2018-05-10T18:51:27.040717 #4] FATAL -- : [a6f3abd4-eb65-4517-aaaf-c6220c4e345a] Selenium::WebDriver::Error::WebDriverError (Could not find Firefox binary (os=linux). Make sure Firefox is installed or set the path manually with Selenium::WebDriver::Firefox::Binary.path=):
2018-05-10T18:51:27.040872+00:00 app[web.1]: F, [2018-05-10T18:51:27.040795 #4] FATAL -- : [a6f3abd4-eb65-4517-aaaf-c6220c4e345a]
2018-05-10T18:51:27.040914+00:00 app[web.1]: F, [2018-05-10T18:51:27.040875 #4] FATAL -- : [a6f3abd4-eb65-4517-aaaf-c6220c4e345a] lib/process_aet.rb:51:in `do_login'
2018-05-10T18:51:27.040916+00:00 app[web.1]: [a6f3abd4-eb65-4517-aaaf-c6220c4e345a] app/controllers/service_orders_controller.rb:131:in `process_aet'
In lib/process_aet.rb:51
:
@session.visit("https://www.google.com/")
Can I help me? Why this error is occurring?
Hey @PedroPauloML -- I think your error might come from this line:
@session = Capybara::Session.new(:selenium)
You are using the default :selenium
driver, which I think defaults to Firefox. You might want to try this instead:
@session = Capybara::Session.new(:selenium)
@PedroPauloML I think @joshwlewis wanted to say, you should try
@session = Capybara::Session.new(:chrome)
I think I'm trying to fix the same error then you , but without success at the moment.
I have another solution worth trying:
in rails-helper.rb
go to this line and change :firefox
to :chrome
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, :browser => :firefox)
end
to
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)
end
then, go to https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver
and run this:
brew tap homebrew/cask && brew cask install chromedriver