Learn to Capybara in 12 minutes

Welcome to the Capybara obstacle course.

Please read the instructions.

Objective

This site is a playground for practicing sending instructions to an automated browser using Capybara. We recommend you refer to a cheat sheet while attempting the challenges.


Setup

Create a Gemfile listing two dependencies:


        source "https://rubygems.org"
        gem 'capybara'
        gem 'selenium-webdriver'

Run the following in PRY or IRB:


        >> pry
        [1] pry(main)> require 'capybara'
        => true
        [2] pry(main)> require 'selenium-webdriver'
        => true
        [3] pry(main)> require 'capybara/dsl'
        => true
        [4] pry(main)> include Capybara::DSL
        including Capybara::DSL in the global scope is not recommended!
        => Object
        [5] pry(main)> Capybara.default_driver = :selenium
        => :selenium
        [6] pry(main)> visit 'http://capybara-workout.herokuapp.com'
        => ""
        [7] pry(main)> click_link 'Start Workout!'

Start Workout!