mechanize:Mechanize::Page::Link#attributes
以下のような HTML で
<html> <head> <title>link test</title> </head> <body> <a href="http://foo.org/" target="_blank">foo</a> <a href="http://bar.org/">bar</a> </body> </html>
>> require 'mechanize' => true >> agent = Mechanize.new => #<Mechanize:0xb7481360 ... >> page = agent.get('http://127.0.0.1:8080/test06_link.html') => #<Mechanize::Page {url #<URI::HTTP:0xb747daa8 URL:http://127.0.0.1:8080/test06_link.html>} {meta} {title "link test"} {iframes} {frames} {links #<Mechanize::Page::Link "foo" "http://foo.org/"> #<Mechanize::Page::Link "bar" "http://bar.org/">} {forms}> >> page.link_with(:href => //).class => Mechanize::Page::Link >> page.link_with(:href => //).attributes => #<Nokogiri::XML::Element:0x..fdba3b500 name="a" attributes=[#<Nokogiri::XML::Attr:0x..fdba380a8 name="href" value="http://foo.org/">, #<Nokogiri::XML::Attr:0x..fdba3809e name="target" value="_blank">] children=[#<Nokogiri::XML::Text:0x..fdba37d9c "foo">]> >> page.link_with(:href => //).node => #<Nokogiri::XML::Element:0x..fdba3b500 name="a" attributes=[#<Nokogiri::XML::Attr:0x..fdba380a8 name="href" value="http://foo.org/">, #<Nokogiri::XML::Attr:0x..fdba3809e name="target" value="_blank">] children=[#<Nokogiri::XML::Text:0x..fdba37d9c "foo">]>