Search code examples
htmlunit

Does HtmlUnit parse HTML before getting an element. How to get the request generated by HtmlUnit


1) Does HtmlUnit parse HTML before getting an element (by sth. like HtmlWebPage.getElementBy... )? Can it be turn off? It seems to be one of the longest operations . I'd like to parse whole response by myself, not really to create HtmlElement (but if someone Could tell me how to do that , it'd be useful ) , but just to get acontent.


2) Is there a way to get the request send to host by HtmlUnit?


3) Does setting new setStatusHandler 'distables' throwing ExceptionOnFailingStatusCode? Is there any defoult StatusHandler ? Can We extend it?


Solution

  • The parsing of HTML into testable objects is exactly what HtmlUnit adds, and if you don't need that, then you don't need the extra layer of HtmlUnit. Perhaps you really only need to be using HttpClient, which is what HtmlUnit uses to handle all of the communication with sites?