JavaでHtmlunitを使用しています。text() で要素を見つける必要があり、この要素の 2 番目のいとこが必要です (と思います)。
私はこれを試しました:
HtmlElement element = page.getFirstByXPath("//*[text() = \"SOMETHING\"]/parent/following-sibling/child");
System.out.println(element.asText()); // it's null
更新: HTML ソース ページ:
<tr>
<script>
_l('its not important')
</script>
<td valign="top">
<font class="its not important">
</td>
<td valign="top">
<font class="its not important">
SOMETHING
<script>
_l('its not important')
</script>
</font>
<script>
_l('its not important')
</script>
</td>
</tr>
<tr>
<td></td>
<td valign="top">
THE INFORMATION I NEED
</td>
</tr>