RSpec Cannot Resolve 'Failed to find Chrome binary.' Error

Asked 2 years ago, Updated 2 years ago, 416 views

I was creating a test using RSpec during portfolio creation, but I got the following error:

Development Environment:
Ruby 2.5.1
Rails 5.2.4.3
Mac OS

 1.1) Failure/Error: visit login_path
      
      Webdrivers::BrowserNotFound:
        Failed to find Chrome binary.

I did my own research and tried the following solution, but the error did not disappear.
·Describe 'webdriver' in Gemfile→bundle
·Install the same version of Chrome-driver as Google-Chrome

$which chromedriver                    
/usr/local/bin/chromedriver

Please let me know if there is a solution.
Thank you for your cooperation.

Note:
Feature Spec test file.

require 'rails_helper'

describe 'Practice Record Posting Function', type: :system do
  describe 'post list display' do
    before do
      # Have User A created
      user_a=FactoryBot.create(:user,nickname: 'User A', email: '[email protected]')
      # keep a practice record of user A
      FactoryBot.create(:training_post, training_impression: 'RSspec Test', user:user_a)
    end
    context 'when user A is logged in' do
      before do
        # Log in as user A
        visit login_path
        fill_in'session_email', with: '[email protected]'
        fill_in'session_password', with: 'password'
        click_button 'Log in'
      end
      it 'Displays practice records created by user A' do
        #Verify that the completed practice record is displayed on the screen.
        expect(page).to have_content 'RSspec Test'
      end
    end
  end
end

ruby-on-rails ruby rspec selenium-webdriver chromedriver

2022-09-30 21:50

1 Answers

It's solved.
The reason for the error was that /Applications/Google Chrome.app should have been /Applications/Google Chrome2.app.I think I installed Chrome twice when I set up my PC, so I used Google Chrome 2.app.


2022-09-30 21:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.