From: Marc G. <mgu...@ya...> - 2015-04-22 13:05:06
|
Hi, your code doesn't let HtmlUnit time to do anything with the page as you close it too early. I would rather try: final WebClient webClient = new WebClient(BrowserVersion.FIREFOX_31); HtmlPage page = webClient.getPage("http://appointment-service.com/cmt2_lefoodtruck"); webClient.waitForBackgroundJavaScript(40000); // or Thread.sleep(10000); // in case the problem comes from waitForBackgroundJavaScript System.out.println(page.asXml()); webClient.close(); Cheers, Marc. -- HtmlUnit support & consulting from the source Blog: http://mguillem.wordpress.com Le 21/04/2015 12:29, Alamgir Farouk a écrit : > our site (test) is > http://appointment-service.com/cmt2_lefoodtruck > (ignore the names, they have no meaning) > > In order to optimize loading on a mobile phone, we download the bulk of > they javascript and css dynamically, via a small javascript function. I > am not sure if this is the problem or something else is wrong, but when > I try to load this site using HtmlUnit, it appears that the javascript > is not being executed. > (java excerpt) > final WebClient webClient = new > WebClient(BrowserVersion.INTERNET_EXPLORER_11); > webClient.waitForBackgroundJavaScript(40000); > HtmlPage page = > webClient.getPage("http://appointment-service.com/cmt2_lefoodtruck"); > System.out.println(page.asXml()); > webClient.close(); > > What are our options? We are trying to create html snapshots for Google > indexing. > > Thanks |