Search code examples
javahttp-unit

Seeing the results ofHttpUnitOptions.setLoggingHttpHeaders(true); internally to an HttpUnit project?


My goal is to be able to use HttpUnit to crawl around my webpage and see what is and is not firing in the background... I have gotten it to connect to my page, and if I set

HttpUnitOptions.setLoggingHttpHeaders(true);

I see the sorts of background calls that I care about. However, I do not know how to see those interactions within the program. most of the getText and getInputStream calls fo the WebResponse object seem to just be the HTML call, and don't log the various javascript calls that fire in the background. Is there a way to get a list of all of the things going on in the background? HttpUnit's documentation seems sparse.

Thanks!


Solution

  • I just stumbled upon the answer. it looks like you need to make a class that implements WebClientListener, and then call wc.addClientListener(new YourListener()); where wc is a WebClient.

    I don't delete this so others can see...and perhaps there is more nuance to it than that.