You need to view the page and interact with it, for example:
final WebClient web = new HtmlUnit(); final HtmlPage page = web.getPage("http://www.whateveryouwant.com.br");
Get items by tag and iterate over it:
final List<DomElement> spans = page.getElementTagName("span"); for (DomElement element : spans) { if (element.getAttribute("class").equals("tim tim-dep")) { return element.getNodeValue(); } }
Or just use XPath:
// Not sure what getFirstByXPath return DomElement element = page.getFirstByXPath("//span[@class='tim tim-dep']"); final String text = element.getNodeValue();
brnfd source share