mechanize:Mechanize::Form#radiobuttons
以下のような 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:0xb74c6604 ... >> page = agent.get('http://127.0.0.1:8080/test13_radiobutton.html') => #<Mechanize::Page {url #<URI::HTTP:0xb74bc71c URL:http://127.0.0.1:8080/test13_radiobutton.html>} {meta} {title "form test"} {iframes} {frames} {links} {forms #<Mechanize::Form {name "form1"} {method "GET"} {action "cgi/foo00.cgi"} {fields} {radiobuttons #<Mechanize::Form::RadioButton:0xb74b40a8 @checked=true, @name="radio1", @value="foo"> #<Mechanize::Form::RadioButton:0xb74b3f40 @checked=false, @name="radio1", @value="bar">} {checkboxes} {file_uploads} {buttons}>}> >> page.form_with(:name => "form1").radiobuttons => [#<Mechanize::Form::RadioButton:0xb74b40a8 @checked=true, @name="radio1", @value="foo", @form=#<Mechanize::Form {name "form1"} {method "GET"} {action "cgi/foo00.cgi"} {fields} {radiobuttons #<Mechanize::Form::RadioButton:0xb74b40a8 @checked=true, @name="radio1", @value="foo"> #<Mechanize::Form::RadioButton:0xb74b3f40 @checked=false, @name="radio1", @value="bar">} {checkboxes} {file_uploads} {buttons}> , @node=#<Nokogiri::XML::Element:0x..fdba5a0c2 name="input" attributes=[#<Nokogiri::XML::Attr:0x..fdba54ff0 name="type" value="radio">, #<Nokogiri::XML::Attr:0x..fdba54fe6 name="name" value="radio1">, #<Nokogiri::XML::Attr:0x..fdba54fdc name="value" value="foo">, #<Nokogiri::XML::Attr:0x..fdba54fd2 name="checked" value="checked">]>>, #<Mechanize::Form::RadioButton:0xb74b3f40 @checked=false, @name="radio1", @value="bar", @form=#<Mechanize::Form {name "form1"} {method "GET"} {action "cgi/foo00.cgi"} {fields} {radiobuttons #<Mechanize::Form::RadioButton:0xb74b40a8 @checked=true, @name="radio1", @value="foo"> #<Mechanize::Form::RadioButton:0xb74b3f40 @checked=false, @name="radio1", @value="bar">} {checkboxes} {file_uploads} {buttons}> , @node=#<Nokogiri::XML::Element:0x..fdba5a072 name="input" attributes=[#<Nokogiri::XML::Attr:0x..fdba532fe name="type" value="radio">, #<Nokogiri::XML::Attr:0x..fdba532f4 name="name" value="radio1">, #<Nokogiri::XML::Attr:0x..fdba532ea name="value" value="bar">]>>]