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)
end

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

http://chromedriver.storage.googleapis.com/index.html?path=2.15/
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.


14 thoughts on “Testing Rspec with Capybara and Selenium”

  • 1
    website for business on July 17, 2015 Reply

    After reading this post, you are able to tell you’re a professional writer with lots of experience.

  • 2
    sewer lines on January 30, 2016 Reply

    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.

  • 3
    quest Bars on February 17, 2016 Reply

    Thanks for finally talking about > Testing Rspec with Capybara and Selenium
    | Twinkal Savani < Liked it!

  • 4
    quest bars on February 18, 2016 Reply

    Good post however I was wondering if you could
    write a litte more on this subject? I’d be very thankful if you
    could elaborate a little bit further. Bless you!

  • 5
    quest bars on February 18, 2016 Reply

    I’d like to find out more? I’d love to find out more
    details.

  • 6
    Darrin Tonozzi on April 21, 2016 Reply

    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. . . . . .

  • 7
    furtdso linopv on April 26, 2016 Reply

    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.

  • 8
    home on July 17, 2016 Reply

    I have been reading out some of your articles and i can state nice stuff. I will definitely bookmark your site.

  • 9
    recommended reading on July 17, 2016 Reply

    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 🙂

  • 10
    go to this website on July 18, 2016 Reply

    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.

  • 11
    browse around this site on July 18, 2016 Reply

    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.

  • 12
    DennisSAdamo on August 8, 2016 Reply

    This really is a good tip especially to people unfamiliar with the blogosphere.
    Simple but very precise information

  • 13
    why not try this out on August 22, 2016 Reply

    Good write-up, I?¦m normal visitor of one?¦s site, maintain up the excellent operate, and It is going to be a regular visitor for a lengthy time.

  • 14
    cours de theatre on June 1, 2017 Reply

    Great blog article. Really Cool.

Leave a Reply

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