From: Yacov S. <yac...@gm...> - 2016-06-25 11:22:19
|
0down votefavorite <http://stackoverflow.com/questions/37940372/htmlunit-hangs-with-specific-url#> I have a test method for parsing an HTML page using HtmlUnit. The problem is that the call to webClient.getPage(testURL) hangs forever with the specific URL given. I have set a timeout of 40 seconds using webClient.getOptions().setTimeout but this doesn't help. Any ideas? I am using HtmlUnit version 2.19. Here is the code: @Test public void testHtmlUnitPage() throws Exception { String testURL = "http://www.baba-mail.co.il/content.aspx?emailid=33124"; WebClient webClient; webClient = new WebClient(BrowserVersion.FIREFOX_38); webClient.getOptions().setThrowExceptionOnFailingStatusCode(false); webClient.getOptions().setThrowExceptionOnScriptError(false); webClient.getOptions().setUseInsecureSSL(true); webClient.getOptions().setTimeout(40000); webClient.getOptions().setRedirectEnabled(true); webClient.getOptions().setJavaScriptEnabled(true); webClient.setAjaxController(new NicelyResynchronizingAjaxController()); webClient.getCookieManager().setCookiesEnabled(true); try { HtmlPage page = webClient.getPage(testURL); Assert.assertNotNull(page); } catch (UnknownHostException |SocketTimeoutException |ConnectTimeoutException | HttpHostConnectException e) { Assert.fail(); } } |