0
getByXPathを使用してHTMLPageオブジェクトからDomNodeオブジェクトのリストを抽出しました。しかし、getByXPathを使用して返されたDomNodeオブジェクトを再度照会しようとすると、結果はHTMLPageオブジェクトを照会したかのようになります。 XPathの中HtmlUnitでDomNodeでgetByXPathを呼び出す
final WebClient webClient = new WebClient();
HTMLPage page = (HtmlPage) webClient.getPage("http://test.page.com");
final List<HtmlTableCell> cells = (List<HtmlTableCell>) page.getByXPath("//td[@width='85%']");
// Number of cells: 16
logger.debug("Number of cells: " + cells.size());
HtmlTableCell cell = cells.get(0);
final List<HtmlTableCell> childCells = (List<HtmlTableCell>) cell.getByXPath("//td[@width='85%']");
// Number of cells: 16
logger.debug("Number of cells: " + childCells.size());
こんにちは、私はあなたが提供した参照リンクに基づいて、同じ質問があります、私は使ってみました。 //ではなく現在のノードでは、エラーが発生しました。それは正しいものですか? XPathの前に式を使用しなかった場合はどうなりますか? –