I have the following code:
HtmlPage searchPage = mainWebClient.getPage(searchUrl);
List<HtmlListItem> lis = searchPage.getByXPath("//div[@id='mainContent']//li[contains(@id, 'results-listing')]");
for (HtmlListItem li : lis) {
List<Object> linkXPath = li.getByXPath("//a[contains(@class, 'itemlink')]/@href");
}
On the fourth line I want to search with XPath only in the li and not in the whole page. If i put there: searchPage.getByXPath("//a[contains(@class, 'itemlink')]/@href"); the result will be the same. How to search not in the whole document but only in the li ?