diff --git a/lib/mechanize/form.rb b/lib/mechanize/form.rb index 1509a80a..0c1ba14c 100644 --- a/lib/mechanize/form.rb +++ b/lib/mechanize/form.rb @@ -305,7 +305,7 @@ def build_query(buttons = []) successful_controls = [] (fields + checkboxes).reject do |f| - f.node["disabled"] + f.node["disabled"] || f.node["name"] == "" end.sort.each do |f| case f when Mechanize::Form::CheckBox diff --git a/test/test_mechanize_form.rb b/test/test_mechanize_form.rb index e3b1b751..610a4bdd 100644 --- a/test/test_mechanize_form.rb +++ b/test/test_mechanize_form.rb @@ -65,6 +65,18 @@ def test_build_query_blank_form assert query.all? { |x| x[1] == '' } end + def test_build_query_blank_input_name + html = Nokogiri::HTML <<-HTML +
+ +
+ HTML + + form = Mechanize::Form.new html.at('form'), @mech, @page + + assert_equal [], form.build_query + end + def test_build_query_radio_button_duplicate html = Nokogiri::HTML <<-HTML