<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -105,6 +105,10 @@ module Webrat
     def matches_value?(value)
       @element[&quot;value&quot;] =~ /^\W*#{Regexp.escape(value.to_s)}/i
     end
+    
+    def matches_caption?(value)
+      @element.innerHTML =~ /^\W*#{Regexp.escape(value.to_s)}/i
+    end
 
     def to_param
       return nil if @value.nil?</diff>
      <filename>lib/webrat/field.rb</filename>
    </modified>
    <modified>
      <diff>@@ -37,6 +37,11 @@ module Webrat
         return possible_button if possible_button.matches_value?(value)
       end
       
+      #If nothing matched on value, try by name. 
+      possible_buttons.each do |possible_button|
+        return possible_button if possible_button.matches_caption?(value)
+      end
+      
       nil
     end
 </diff>
      <filename>lib/webrat/form.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2855b4382f7e6db9da68b7998b739567714a68ee</id>
    </parent>
  </parents>
  <author>
    <name>Gwyn Morfey</name>
    <email>gwyn@new-bamboo.co.uk</email>
  </author>
  <url>http://github.com/gwynm/webrat/commit/20561b0c411c687cd755be381109937910fcda97</url>
  <id>20561b0c411c687cd755be381109937910fcda97</id>
  <committed-date>2008-04-29T04:26:16-07:00</committed-date>
  <authored-date>2008-04-29T04:26:16-07:00</authored-date>
  <message>Also find buttons by caption, if no value has been specified.</message>
  <tree>90e65f593a0d431edc2c5c9d8e1c38e3ad7d3114</tree>
  <committer>
    <name>Gwyn Morfey</name>
    <email>gwyn@new-bamboo.co.uk</email>
  </committer>
</commit>
