From: dhashi88 <dha...@ho...> - 2014-08-25 08:15:33
|
Im using HtmlUnit to grab content of web page (having javascript) Stopwatch timer = new Stopwatch().start(); final WebClient webClient = newWebClient(BrowserVersion.CHROME); webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); webClient.getOptions().setJavaScriptEnabled(true); webClient.getOptions().setActiveXNative(false); webClient.getOptions().setAppletEnabled(false); webClient.getOptions().setCssEnabled(false); webClient.getOptions().setDoNotTrackEnabled(true); webClient.getOptions().setGeolocationEnabled(false); webClient.getOptions().setPopupBlockerEnabled(true); webClient.getOptions().setPrintContentOnFailingStatusCode(false); webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); webClient.getOptions().setThrowExceptionOnScriptError(false); webClient.getOptions().setUseInsecureSSL(true); webClient.setCssErrorHandler(newSilentCssErrorHandler()); webClient.getCookieManager().setCookiesEnabled(false); webClient.getOptions().setRedirectEnabled(false); webClient.getOptions().setTimeout(900); System.out.println("1.0 : " + timer.elapsed(TimeUnit.MILLISECONDS)); final HtmlPage page = webClient.getPage(url); System.out.println(page.getWebResponse().getLoadTime()); System.out.println("1.1 : " + timer.elapsed(TimeUnit.MILLISECONDS)); then the result i got is like this 1.0 : 2 707 1.1 : 8003 Why webclient consuming more time (more than webresponse load time)? how can i reduce that time? |