diff --git a/lib/webrat/core/field.rb b/lib/webrat/core/field.rb index 471d0a4..700f796 100644 --- a/lib/webrat/core/field.rb +++ b/lib/webrat/core/field.rb @@ -42,6 +42,10 @@ module Webrat label.matches_text?(label_text) end + def matches_alt?(alt) + @element["alt"] =~ /^\W*#{Regexp.escape(alt.to_s)}/i + end + def to_param param_parser.parse_query_parameters("#{name}=#{@value}") end @@ -123,7 +127,7 @@ module Webrat end def matches_value?(value) - @element["value"] =~ /^\W*#{Regexp.escape(value.to_s)}/i || matches_text?(value) + @element["value"] =~ /^\W*#{Regexp.escape(value.to_s)}/i || matches_text?(value) || matches_alt?(value) end def to_param