mechanize:Mechanize::Form::RadioButton#[]
以下のような HTML で
<html> <head> <title>form test</title> </head> <body> <form method="get" action="cgi/foo00.cgi" name="form1"> <input type="radio" name="radio1" value="foo" checked="checked" />Foo <input type="radio" name="radio1" value="bar" />Bar </form> </body> </html>
>> require 'mechanize' => true >> agent = Mechanize.new => #<Mechanize:0xb745d604 ... >> page = agent.get('http://127.0.0.1:8080/test13_radiobutton.html') => #<Mechanize::Page ... >> f = page.form('form1') => #<Mechanize::Form ... >> f.radiobuttons[0].node => #<Nokogiri::XML::Element:0x..fdba28892 name="input" attributes=[#<Nokogiri::XML::Attr:0x..fdba23234 name="type" value="radio">, #<Nokogiri::XML::Attr:0x..fdba2322a name="name" value="radio1">, #<Nokogiri::XML::Attr:0x..fdba23220 name="value" value="foo">, #<Nokogiri::XML::Attr:0x..fdba23216 name="checked" value="checked">]> >> f.radiobuttons[0]['name'] => "radio1" >> f.radiobuttons[0]['value'] => "foo"