Why use capybara

I would like to start using capybara, but there is very little information about it, how should I start?

The first question I would like to ask is… why? What is your current test automation set up like? Are you looking to implement it from scratch? Is someone in the company already using it?


Hi Daniela

So the starting point is I am assuming you are using Ruby, as Capybara is a Ruby library. So is Watir, which is also popular. Both are wrappers that contain Selenium. As regards how often it is used, its popularity (and Ruby generally) is dropping.

If you want to learn Capybara, I suggest the following (I’m writing this for people who may not have any basics in Ruby and/or Capybara, so forgive me if I am stating things that you already know):
Always learn the language first (if you don’t already know it, before trying to automate anything, it doesn’t help to learn automation and THEN the language).

  1. Learn Ruby (the language, not automation). Use something like Codecademy. Don’t get a Pro subscription. It’s enough to use the free version.
  2. Practice your new skills with Kata sites such as codewars.com (others are available too). Do the “Fundamentals” problems. It’s gamified by levelling up from “8kyu” to higher levels, like judo/karate. I’m at 5kyu. I don’t need to be an expert, I just try to keep my skills sharp. The advantage of using Codewars is that I earn while trying to solve challenges, and then I learn again when I see how other people did it. e.g. shortcuts, other syntax improvements, new methods etc.

Then, on Test Automation University [TAU] (https://testautomationu.applitools.com/) do the following courses in this order:

  1. Ruby: https://testautomationu.applitools.com/selenium-webdriver-with-ruby/index.html. This gives you grounding in basic Selenium syntax in Ruby.
  2. Locators: https://testautomationu.applitools.com/web-element-locator-strategies/index.html. This gives you a fantastic grounding in using locators (and it works across all languages)
  3. Capybara: https://testautomationu.applitools.com/capybara-ruby/index.html

Note that there is a dedicated Slack community for TAU and a channel for each course.

BIG CAVEAT: Ruby is not very in demand for automation any more. Python is more popular, but even that is less popular than C# and Java, or JS. :frowning:

Best of luck