Testing Rspec with Capybara and Selenium

How to set up Capybara and Selenium in ruby on rails application?

First of all add gems into gemfile:

gem 'capybara'
gem "selenium-webdriver"
gem 'chromedriver-helper'

After Adding new gem, its time to bundle install

bundle install

Now, We need to tell application that we are using capybara with Rspec testing, to do so we need to add following code into rails_helper.rb file

require 'capybara/rspec'
require 'capybara/rails'

In order to run test cases in particular browser, need to set default browser.To Set default browser for test suits, Add below code into rails_helper.rb

Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, :browser => :chrome)

Now we are ready to write test suits for our application but before that if any Error raised like driver not found , to resolve that we would need to install Chromedriver.exe

Move downloaded file Chromedriver.exe to C:\ruby\bin folder

This is all about how to set up capybara with selenium, If you are looking for Example, Here is github link Cucumber, capybara, selenium testing

Please log an issue here.

17 Replies to “Testing Rspec with Capybara and Selenium”

  1. Just wish to say your article is as surprising. The clarity in your
    post is simply nice and i could assume you’re an expert on this subject.
    Well with your permission allow me to grab your feed to keep updated with forthcoming post.
    Thanks a million and please continue the rewarding work.

  2. Howdy very cool blog!! Man .. Excellent .. Amazing .. I will bookmark your blog and take the feeds additionally…I am happy to find a lot of useful information right here in the submit, we’d like develop more strategies in this regard, thank you for sharing. . . . . .

  3. Thank you for sharing superb informations. Your site is so cool. I am impressed by the details that you¦ve on this website. It reveals how nicely you perceive this subject. Bookmarked this website page, will come back for more articles. You, my pal, ROCK! I found simply the info I already searched everywhere and simply couldn’t come across. What a perfect site.

  4. I like what you guys are up also. Such intelligent work and reporting! Keep up the superb works guys I’ve incorporated you guys to my blogroll. I think it will improve the value of my site 🙂

  5. I have recently started a website, the information you offer on this site has helped me tremendously. Thank you for all of your time & work. “Character is much easier kept than recovered.” by Thomas Paine.

  6. Nice post. I was checking continuously this blog and I’m impressed! Very helpful information specially the last part 🙂 I care for such info much. I was looking for this certain info for a long time. Thank you and best of luck.

  7. Good day! Would you mind if I share your blog with my facebook group?
    There’s a lot of folks that I think would really appreciate your content.
    Please let me know. Cheers

Leave a Reply

Your email address will not be published. Required fields are marked *