[Mechanize-users] links behavior in 0.6.0

Mat Schaffer schapht at gmail.com
Fri Sep 8 13:24:27 EDT 2006


Here's what I mentioned on ruby-talk a little while ago.  Basically  
mechanize 0.5.4 could match a link on a regexp regardless of children  
in that link.  0.6.0 can't.

Here's a demonstration, but I can't get require_gem to properly load  
0.5.4 for some reason.  I keep getting "uninitialized constant WWW  
(NameError)".

Under 0.5.4 it will return both links, but under 0.6.0 it'll only  
return the one without the <b> child.

-- mech_test.rb

require 'rubygems'
require 'mechanize'

agent = WWW::Mechanize.new
page = agent.get(<URL for test.html>)
p page.links.text(/Dude/)

--

-- test.html
<html>
<body>
<a href="thing.html"><b>Bold Dude</b></a>
<a href="thing.html">Dude</a>
</body>
</html>
--




More information about the Mechanize-users mailing list