fix parse input without type attribute

This commit is contained in:
Anton Maminov 2021-08-18 17:50:03 +03:00
parent 2d6f22f8b9
commit f3c0af6460
2 changed files with 2 additions and 2 deletions

View File

@ -8,7 +8,7 @@ WebMock.stub(:get, "example.com/check_form").to_return(body: <<-BODY
<body> <body>
<form action="post_path" method="post" name="sample_form"> <form action="post_path" method="post" name="sample_form">
<!-- fields --> <!-- fields -->
<input type="text" name="name"> <input name="name">
<input type="text" name="email"> <input type="text" name="email">
<input type="hidden" name="userid" value="12345"> <input type="hidden" name="userid" value="12345">
<input type="password" id="pass" name="password"> <input type="password" id="pass" name="password">

View File

@ -65,7 +65,7 @@ class MechanizeCr::Form
private def parse private def parse
@node.css("input").not_nil!.each do |html_node| @node.css("input").not_nil!.each do |html_node|
html_node = html_node.as(Lexbor::Node) html_node = html_node.as(Lexbor::Node)
type = (html_node["type"] || "text").downcase type = (html_node["type"]? || "text").downcase
case type case type
when "checkbox" when "checkbox"
checkboxes << FormContent::CheckBox.new(html_node, self) checkboxes << FormContent::CheckBox.new(html_node, self)