-
-
Save ryanmcgary/f7a8661d4ade03f9c80412d4baa897a4 to your computer and use it in GitHub Desktop.
Quick start for using Capybara in IRB with Chromedriver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# copy and paste this into your terminal to start an IRB session and use Capybara's DSL to write tests interactively | |
# Thanks to Tom Clements | |
# http://tom-clements.com/blog/2012/02/25/capybara-on-the-command-line-live-browser-testing-from-irb/ | |
# I prefer using chrome... | |
# First you need to install the chromedriver https://sites.google.com/a/chromium.org/chromedriver/downloads | |
# Unzip, and move the executable somewhere in your path... | |
# e.g. | |
mv ~/Downloads/chromedriver /usr/local/bin | |
irb | |
require 'capybara/dsl' | |
include Capybara::DSL | |
#register the chrome driver | |
Capybara.register_driver :chrome do |app| | |
Capybara::Selenium::Driver.new(app, :browser => :chrome) | |
end | |
Capybara.default_driver = :chrome | |
visit "http://www.google.com" #etc... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment