Merge pull request #6 from mamantoha/fix-input-without-type

fix parse input without type attribute
This commit is contained in:
Kanezoh 2021-08-19 08:39:02 +09:00 committed by GitHub
commit 6f8e9f743b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)