mechanize:Mechanize::Page#labels

以下のような HTML で

<html>
<head>
<title>label test</title>
</head>
<body>

<form method="post" action="cgi/test_form00.cgi" name="form1">
 <input type="radio" name="radio1" id="r1" value="male" checked="checked"><label for="r1">Male</label>
 <input type="radio" name="radio1" id="r2" value="female"><label for="r2">Female</label>
</form>

</body>
</html>
>> require 'mechanize'
=> true
>> agent = Mechanize.new
=> #<Mechanize:0xb7452380 ...
>> page = agent.get('http://127.0.0.1:8080/test05_label.html')
=> #<Mechanize::Page
 {url #<URI::HTTP:0xb744ea64 URL:http://127.0.0.1:8080/test05_label.html>}
 {meta}
 {title "label test"}
 {iframes}
 {frames}
 {links}
 {forms
  #<Mechanize::Form
   {name "form1"}
   {method "POST"}
   {action "cgi/test_form00.cgi"}
   {fields}
   {radiobuttons
    #<Mechanize::Form::RadioButton:0xb74460a8
     @checked=true,
     @name="radio1",
     @value="male">
    #<Mechanize::Form::RadioButton:0xb7445f40
     @checked=false,
     @name="radio1",
     @value="female">}
   {checkboxes}
   {file_uploads}
   {buttons}>}>

>> page.labels
=> [#<Mechanize::Page::Label:0xb7440644 @page=#<Mechanize::Page
 {url #<URI::HTTP:0xb744ea64 URL:http://127.0.0.1:8080/test05_label.html>}
 {meta}
 {title "label test"}
 {iframes}
 {frames}
 {links}
 {forms
  #<Mechanize::Form
   {name "form1"}
   {method "POST"}
   {action "cgi/test_form00.cgi"}
   {fields}
   {radiobuttons
    #<Mechanize::Form::RadioButton:0xb74460a8
     @checked=true,
     @name="radio1",
     @value="male">
    #<Mechanize::Form::RadioButton:0xb7445f40
     @checked=false,
     @name="radio1",
     @value="female">}
   {checkboxes}
   {file_uploads}
   {buttons}>}>
, @text="Male", @node=#<Nokogiri::XML::Element:0x..fdba2034a name="label" attributes=[#<Nokogiri::XML::Attr:0x..fdba1e2c0 name="for" value="r1">] children=[#<Nokogiri::XML::Text:0x..fdba1e0a4 "Male">]>>, #<Mechanize::Page::Label:0xb74405cc @page=#<Mechanize::Page
 {url #<URI::HTTP:0xb744ea64 URL:http://127.0.0.1:8080/test05_label.html>}
 {meta}
 {title "label test"}
 {iframes}
 {frames}
 {links}
 {forms
  #<Mechanize::Form
   {name "form1"}
   {method "POST"}
   {action "cgi/test_form00.cgi"}
   {fields}
   {radiobuttons
    #<Mechanize::Form::RadioButton:0xb74460a8
     @checked=true,
     @name="radio1",
     @value="male">
    #<Mechanize::Form::RadioButton:0xb7445f40
     @checked=false,
     @name="radio1",
     @value="female">}
   {checkboxes}
   {file_uploads}
   {buttons}>}>
, @text="Female", @node=#<Nokogiri::XML::Element:0x..fdba20318 name="label" attributes=[#<Nokogiri::XML::Attr:0x..fdba1c056 name="for" value="r2">] children=[#<Nokogiri::XML::Text:0x..fdba1be3a "Female">]>>]
>> page.labels[0].node
=> #<Nokogiri::XML::Element:0x..fdba2034a name="label" attributes=[#<Nokogiri::XML::Attr:0x..fdba1e2c0 name="for" value="r1">] children=[#<Nokogiri::XML::Text:0x..fdba1e0a4 "Male">]>
>> page.labels[0].text
=> "Male"
>> page.labels[0].page
=> #<Mechanize::Page
 {url #<URI::HTTP:0xb744ea64 URL:http://127.0.0.1:8080/test05_label.html>}
 {meta}
 {title "label test"}
 {iframes}
 {frames}
 {links}
 {forms
  #<Mechanize::Form
   {name "form1"}
   {method "POST"}
   {action "cgi/test_form00.cgi"}
   {fields}
   {radiobuttons
    #<Mechanize::Form::RadioButton:0xb74460a8
     @checked=true,
     @name="radio1",
     @value="male">
    #<Mechanize::Form::RadioButton:0xb7445f40
     @checked=false,
     @name="radio1",
     @value="female">}
   {checkboxes}
   {file_uploads}
   {buttons}>}>