mechanize:Mechanize::Page::Image#node
以下のような HTML で
<html> <head> <title>image test</title> </head> <body> <img src="img1.png" width="256" height="128" alt="foo"> <img src="img2.png" width="200" height="100" alt="bar"> </body> </html>
>> require 'mechanize' => true >> agent = Mechanize.new => #<Mechanize:0xb742a538 ... >> page = agent.get('http://127.0.0.1:8080/test04_image.html') => #<Mechanize::Page {url #<URI::HTTP:0xb7426c1c URL:http://127.0.0.1:8080/test04_image.html>} {meta} {title "image test"} {iframes} {frames} {links} {forms}> >> page.images => [#<Mechanize::Page::Image:0xb741d590 @page=#<Mechanize::Page {url #<URI::HTTP:0xb7426c1c URL:http://127.0.0.1:8080/test04_image.html>} {meta} {title "image test"} {iframes} {frames} {links} {forms}> , @node=#<Nokogiri::XML::Element:0x..fdba0eaf0 name="img" attributes=[#<Nokogiri::XML::Attr:0x..fdba0e212 name="src" value="img1.png">, #<Nokogiri::XML::Attr:0x..fdba0e208 name="width" value="256">, #<Nokogiri::XML::Attr:0x..fdba0e1fe name="height" value="128">, #<Nokogiri::XML::Attr:0x..fdba0e1f4 name="alt" value="foo">]>>, #<Mechanize::Page::Image:0xb741d52c @page=#<Mechanize::Page {url #<URI::HTTP:0xb7426c1c URL:http://127.0.0.1:8080/test04_image.html>} {meta} {title "image test"} {iframes} {frames} {links} {forms}> , @node=#<Nokogiri::XML::Element:0x..fdba0eabe name="img" attributes=[#<Nokogiri::XML::Attr:0x..fdba0d574 name="src" value="img2.png">, #<Nokogiri::XML::Attr:0x..fdba0d56a name="width" value="200">, #<Nokogiri::XML::Attr:0x..fdba0d560 name="height" value="100">, #<Nokogiri::XML::Attr:0x..fdba0d556 name="alt" value="bar">]>>] >> page.images[0] => #<Mechanize::Page::Image:0xb741d590 @page=#<Mechanize::Page {url #<URI::HTTP:0xb7426c1c URL:http://127.0.0.1:8080/test04_image.html>} {meta} {title "image test"} {iframes} {frames} {links} {forms}> , @node=#<Nokogiri::XML::Element:0x..fdba0eaf0 name="img" attributes=[#<Nokogiri::XML::Attr:0x..fdba0e212 name="src" value="img1.png">, #<Nokogiri::XML::Attr:0x..fdba0e208 name="width" value="256">, #<Nokogiri::XML::Attr:0x..fdba0e1fe name="height" value="128">, #<Nokogiri::XML::Attr:0x..fdba0e1f4 name="alt" value="foo">]>> >> page.images[0].node => #<Nokogiri::XML::Element:0x..fdba0eaf0 name="img" attributes=[#<Nokogiri::XML::Attr:0x..fdba0e212 name="src" value="img1.png">, #<Nokogiri::XML::Attr:0x..fdba0e208 name="width" value="256">, #<Nokogiri::XML::Attr:0x..fdba0e1fe name="height" value="128">, #<Nokogiri::XML::Attr:0x..fdba0e1f4 name="alt" value="foo">]>