I am trying to use HtmlUnit to make HTML snapshot of my GWT application. The idea is to make my AJAX app crawlable.
Unfortunately, the page I'm fetching doesn't seem complete. It is missing content which is viewable when I visit the page in my normal browser. I only need text in my HTML snapshot. Here is my code:
public class Browser {
public static void main(String[] args) throws IOException, InterruptedException {
final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_10);
webClient.setJavaScriptEnabled(true);//JS is enabled by default but...
webClient.setAjaxController(new NicelyResynchronizingAjaxController());
HtmlPage page = webClient.getPage("http://meridianbet.com");
int n = webClient.waitForBackgroundJavaScript(30000);
System.out.println("Executing " + n + " JavaSript jobs!");
System.out.println("OUTPUT: " + page.asXml());
webClient.closeAllWindows();
}
}
There is still 7 unfinished JS jobs after executing code. And no matter how long I wait that jobs ain't gonna be executed. Any help? //I am using latest htmlunit 2.10