RusKnyaz / Optimus

Optimus is headless Web Browser fully implemented on .net.
MIT License
82 stars 8 forks source link

A bug in Form Submit, <input ** disabled="disabled"></input> #57

Closed sky5454 closed 3 years ago

sky5454 commented 3 years ago
<INPUT id="listqqauth" type="hidden" name="listqqauth" value="" disabled="disabled"></INPUT>

in HTML, the input element who has the disabled="disabled" or has no a name="**" must not to be submit.

but Optimus 2.4.1 submit it, that is wrong.

REFER https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input image

sky5454 commented 3 years ago

Temp Solution:

HtmlFormElement htmlForm = (page.Document.GetElementById("goLoginForm") as HtmlFormElement);
var t = htmlForm.QuerySelectorAll("input");

for (int i = 0; i < t.Count; i++)
{
    if (t[i].HasAttribute("Disabled") == true)
        t[i].RemoveAttribute("name");
}

htmlForm.Submit();

Before submit, just remove the Attr "name".

sky5454 commented 3 years ago

Temp Solution:

HtmlFormElement htmlForm = (page.Document.GetElementById("goLoginForm") as HtmlFormElement);
var t = htmlForm.QuerySelectorAll("input");

for (int i = 0; i < t.Count; i++)
{
    if (t[i].HasAttribute("Disabled") == true)
        t[i].RemoveAttribute("name");
}

htmlForm.Submit();

Before submit, just remove the Attr "name".

Those APIs to edit t[i]'s Attribute has lost in the 3.0.0-beta-305, and 3.0.0-beta-305 also has a same bug as this issue, so How We resolve it?

I wonder if you could release it.