[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] Mechanize - 0.6.2 (Bridget

Aaron Patterson

10/11/2006 6:19:00 AM

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....).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...)
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.

--
Aaron Patterson
http://tenderlovem...