This is a regression since version 2.15.
Summary: <inputs> attaches to the wrong owner <form> when <form> is between <table><tr>
html:
<html>
<body>
<table>
<form name="f1">
<tr>
<td>
<input name="f1_submit" type="submit"/>
</td>
</tr>
</form>
<form name="f2">
</form>
</table>
</body>
</html>
Test code:
HtmlPage page = new WebClient(BrowserVersion.CHROME).getPage(TEST_URL);
HtmlInput input = page.getFirstByXPath("//input[@name='f1_submit']");
String formName = input.getEnclosingForm().getNameAttribute();
formName = "f1"formName = "f2"
This is already fixed. Please update to the latest snapshot build and report back (http://build.canoo.com/htmlunit/artifacts/).
I've checked and can confirm that the current 2.16 snapshot fixes this issue.
Last edit: Atsushi Nakagawa 2014-08-03
Thanks for reporting back.