use of com.gargoylesoftware.htmlunit.html.DomElement in project azure-tools-for-java by Microsoft.
the class YarnHistoryTask method call.
@Override
public String call() throws Exception {
WEB_CLIENT.setCredentialsProvider(credentialsProvider);
HtmlPage htmlPage = WEB_CLIENT.getPage(path);
// parse pre tag from html response
// there's only one 'pre' in response
DomNodeList<DomElement> preTagElements = htmlPage.getElementsByTagName("pre");
if (preTagElements.size() == 0) {
throw new HDIException("No logs here or logs not available");
} else {
return preTagElements.get(0).asText();
}
}
use of com.gargoylesoftware.htmlunit.html.DomElement in project chuidiang-ejemplos by chuidiang.
the class ExtractingLinksWithHtmlUnit method main.
public static void main(String[] args) throws Exception {
WebClient webClient = new WebClient();
HtmlPage page = webClient.getPage("http://www.gnu.org/home.es.html");
DomNodeList<DomElement> nodeList = page.getElementsByTagName("a");
for (DomElement element : nodeList) {
System.out.println(element.getTextContent() + " -> " + element.getAttribute("href"));
}
}
Aggregations