-
-
Notifications
You must be signed in to change notification settings - Fork 184
Closed
Description
Hello,
I am using Htmlunit 2.36.0. version.
I want to get table data below is the code, but not able to get it, but that data is showing on the browser, here is my code:-
public static void main(String[] args) {
String baseUrl = "https://www.pgatour.com/competition/2017/safeway-open/leaderboard.html" ;
WebClient client = new WebClient(BrowserVersion.CHROME);
client.getOptions().setCssEnabled(false);
client.getOptions().setUseInsecureSSL(true);
client.getOptions().setJavaScriptEnabled(true);
client.getOptions().setThrowExceptionOnScriptError(false);
try {
HtmlPage page = client.getPage(baseUrl);
client.waitForBackgroundJavaScriptStartingBefore(100000);
List<Object> playerNames = (List<Object>) page.getByXPath("//div[@class='player-name-col']");
if(playerNames.isEmpty()) {
LOG.info("No Players Found...");
} else {
for(Object obj : playerNames) {
HtmlElement playerName = (HtmlElement) obj;
LOG.info(playerName.asText());
}
} catch (Exception e) {
e.printStackTrace();
} finally {
client.close();
}
}
Can you please help me why I am not able to get the table.
Thanks
Metadata
Metadata
Assignees
Labels
No labels