i5labs

i5labs

Web Automation - Webrat & IRB

I've been looking for a simple method of parsing, clicking and navigation to build web automation scripts.  Thankfully, Bryan Helmkamp & Seth Fitzsimmons developed the easy-to-use Rails acceptance testing system, Webrat.  Through Mechanize, you can remotely select, enter data, and pull data.  Now if you just want to scrape, you can use webrat-scraper, but if you want to be more involved, test through IRB.  This is fairly straightforward, after figuring out how to get Mechanize going.  

Fire up Webrat and get your automation goodness going:

irb

require "mechanize"
require "webrat"

include Webrat::Matchers
include Webrat::Methods
Webrat.configure {|c| c.mode = :mechanize} 
Webrat::Methods.delegate_to_session :response_code, :response_body

click_link "News"

and so forth...

Comments (1)

Jan 16, 2012
Pearl Carbajal said...
This blog makes me realize the energy of words and pictures. As always your things are just gorgeous and I am grateful that you let us look in! Keep coming up with ideas.
http://www.onlinecheck.com/business_loans.html

Leave a comment...