-
-
Notifications
You must be signed in to change notification settings - Fork 181
Closed
Description
This is the demonstration:
Test html:
<html>
<head>
<title>table size</title>
</head>
<body>
<table id="mytable>
<tbody>
<tr>
<td>td</td>
<td>td</td>
<td>td</td>
<td>td</td>
<td>td</td>
<td>td</td>
<td>td</td>
<td>td</td>
</tr>
</tbody>
</table>
</body>
</html>
Test code
HtmlElement table=(HtmlElement)p.getElementById("mytable");
HTMLElement hso=table.getScriptableObject();
int w=hso.getOffsetWidth();
int h=hso.getOffsetHeight();
logger.info("{}, w={}, h={}",hso, w, h);
The table height returned is the heights added up from all TDs. While the actual result should be the height of one TD.
I traced the code and think the problem is here. When calculating the relative top position, htmlunit adds up all the height of it's previous siblings, which is not correct for TD.
Metadata
Metadata
Assignees
Labels
No labels