0

I use HtmlUnit to create Page Snapshots, to be used for various purposes. What i found out was that HtmlUnit is not sending requests in parallel, as it happens in browser (6 parallel requests at a time). Can somebody help me with this ?

My code :-

    wc = new WebClient(BrowserVersion.CHROME);

    //wc.setAjaxController(new NicelyResynchronizingAjaxController());
    //wc.getOptions().setCssEnabled(true); 
    //wc.setCssErrorHandler(new SilentCssErrorHandler());

    wc.getOptions().setThrowExceptionOnFailingStatusCode(false); 
    wc.getOptions().setThrowExceptionOnScriptError(false); 
    wc.getOptions().setRedirectEnabled(false);
    //wc.getOptions().setAppletEnabled(true); 
    wc.getOptions().setJavaScriptEnabled(true);  
    wc.getOptions().setPrintContentOnFailingStatusCode(false);
user3279692
  • 329
  • 2
  • 13

1 Answers1

2

Looks like you can't achieve it now.

According to HtmlUnit docs

In the future downloads should be performed in parallel in separated threads.

Looks like that the future not arrived yet. But you always can try to implement a patch if it's so important for you then send it to the upstream.

Pavel S.
  • 1,267
  • 14
  • 19
  • Thanks Pavel. Could you guide me to a substitute solution ? I cannot PhantomJS or prerender.io because they do not support ajax. So, i need a headless browser in a definite sense. – user3279692 Jul 10 '16 at 18:35
  • If you use any flavour of Unix, you may try to switch Firefox or Chrome in [XVFB](https://www.x.org/archive/X11R7.6/doc/man/man1/Xvfb.1.xhtml), so it would be headless. What about Windows - I have no idea. – Pavel S. Jul 10 '16 at 20:24
  • Hi Pavel, Thanks again! – user3279692 Jul 15 '16 at 09:53