HTMLUnit : javascript 对页面的更改如何获得

HTMLUnit acts like a real browser, so everything  that the javascript done in the HTML page's DOM model will not affect the source of page.
But we can get the updated DOM model from using this method: HtmlPage.asXml().

Maybe a page should finished loading all data by several ajax requests, so sometimes it need to call

webClient.setJavaScriptEnabled(true);
webClient.setJavaScriptTimeout(3600*1000);
webClient.setRedirectEnabled(true);
webClient.setThrowExceptionOnScriptError(true);
webClient.setThrowExceptionOnFailingStatusCode(true);
webClient.setTimeout(3600*1000);

webClient.waitForBackgroundJavaScript(600*1000);
webClient.setAjaxController(new NicelyResynchronizingAjaxController());




And using Thread.sleep( ).

 

你可能感兴趣的:(JavaScript,thread,html,Ajax)