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.
Changes:
Mechanize CHANGELOG
0.6.7
- Fixed a bug with keep-alive requests
- [#9549] fixed problem with cookie paths
7 Comments
I think you should have less of this tech talk and put more of your poetry on your blog. Really.
touche.
When do you think you will update mechanize to work with the latest stable version of Hpricot (0.5.134)? There are a few changes that were made with attributes that is tripping up mechanize 0.6.7.
Typically I keep mechanize working with gems that _why publishes on Rubyforge. I’ll install the latest from _why’s site and see if I can’t get it working with the next release.
Is there any specific problem you are seeing? I’d like to make sure I can reproduce the error you’re getting.
Here’s the exchange from the Hpricot mailing list that talks about the changes to attributes. This is where I’m guess my issue is coming from.
On Fri, Mar 30, 2007 at 03:16:08AM -0400, Craig Davey wrote:
Yes, can do. The real hash will be in rawattributes and
will return an unescaped Hash. So, using
directly isn’t recommended, as it’s slower, use Element#[] or
Element#getattribute instead.
Ok ok ok, salutations!!
_why
Here’s the error I’m getting when trying to crawl a website
/usr/local/lib/ruby/gems/1.8/gems/hpricot-0.5.136/lib/hpricot/xchar.rb:89:in
gsub’ called for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/gems/1.8/gems/hpricot-0.5.136/lib/hpricot/tag.rb:58:in
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
inject’
from /usr/local/lib/ruby/gems/1.8/gems/hpricot-0.5.136/lib/hpricot/tag.rb:57:in
from /usr/local/lib/ruby/gems/1.8/gems/hpricot-0.5.136/lib/hpricot/tag.rb:57:in
inject’
from /usr/local/lib/ruby/gems/1.8/gems/hpricot-0.5.136/lib/hpricot/tag.rb:57:in
from /usr/local/lib/ruby/gems/1.8/gems/mechanize-0.6.7/lib/mechanize/form_elements.rb:220:in
initialize’new’
new’
from /usr/local/lib/ruby/gems/1.8/gems/mechanize-0.6.7/lib/mechanize/formelements.rb:125:in
from /usr/local/lib/ruby/gems/1.8/gems/mechanize-0.6.7/lib/mechanize/form_elements.rb:125:in
initialize’
adoptions/bookadoptions.rb:15:in… 31 levels…
from ./scripts/../grays/book
from ./scripts/../grays/book_adoptions/book_adoptions.rb:15:in
get’
adoptions.rb:29:in `getadoptions’from scripts/get
from scripts/getadoptions.rb:51
I don’t mean to be a bother but I was wondering how the progress is going with updating Mechanize to work with the latest Hpricot gem?
Hey Tim. I’m working on in. Unfortunately this is a pretty big change. Also, I seem to have found a bug in the latest hpricot gem. The bug causes my unit tests to fail, but it is a bug with hpricot.