[ANN] Mechanize - 0.6.2 (Bridget)

A

Aaron Patterson

Mechanize version 0.6.2 (Bridget) is now available.

= Description
The Mechanize library is used for automating interaction with websites.
Mechanize automatically stores and sends cookies, follows redirects, can
follow links, and submit forms. Form fields can be populated and
submitted. Mechanize also keeps track of the sites that you have visited
as a history.

= Example
# This searches google for "Ruby" and prints the results
require 'rubygems'
require 'mechanize'

agent = WWW::Mechanize.new

agent.get("http://www.google.com/").form("f") { |f|
f.q = "Ruby"
}.submit.search("//a[@class='l']").each { |l| puts l.all_text }

= Release Notes

== 0.6.2 (Bridget)

Mechanize 0.6.2 (Bridget) is a fairly small bug fix release. You can now
access the parsed page when a ResponseCodeError is thrown. For example, this
loads a page that doesn't exist, but gives you access to the parsed 404 page:
begin
WWW::Mechanize.new().get('http://google.com/asdfasdfadsf.html')
rescue WWW::Mechanize::ResponseCodeError => ex
puts ex.page
end
Accessing forms is now more DSL like. When manipulating a form, for example,
you can use the following syntax:
page.form('formname') { |form|
form.first_name = "Aaron"
}.submit
Documentation has also been updated thanks to Paul Smith.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,150
Latest member
MakersCBDReviews
Top