0

I have problems with getting content by URL. I'm using HtmlUnit for parsing an HTML page, but when I run my application I don't get content without filling after executed js.

I getting html without needed me content.

Who can help me please ?

Example code:

try (final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_38)) { 
    webClient.waitForBackgroundJavaScript(30 * 1000); 
    final HtmlPage page = webClient.getPage("http://.....some url"); 
    final String pageAsXml = page.asXml(); 
    final String pageAsText = page.asText(); 
 } –
Vitaliy
  • 59
  • 1
  • 1
  • 5
  • example code try (final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_38)) { webClient.waitForBackgroundJavaScript(30 * 1000); final HtmlPage page = webClient.getPage("http://.....some url"); final String pageAsXml = page.asXml(); final String pageAsText = page.asText(); } – Vitaliy Jun 30 '15 at 13:59
  • Please provide your complete case with the URL used, you can edit your post – Ahmed Ashour Jun 30 '15 at 14:17
  • You should wait just after calling .getPage() – Ahmed Ashour Jun 30 '15 at 14:23
  • I've edited your sample code into your question; you can do this yourself by using the "edit" link below your post. Is the returned value `null`, an empty string, or the web page under the URL with some pieces missing? If you target this code at, for example, Stack Overflow, then what happens? Do you get all the content or just some of it? If you could tell us that, maybe it will give us some clues as to what is wrong. Good luck! – S.L. Barth is on codidact.com Jun 30 '15 at 19:12

0 Answers0