HtmlUnit is a pretty decent scriptable browser. I use it for developing alot of website scrapers and various bots. By default, the logging to the standard output stream is pretty verbose. A quick way to disable it programmatically is to add the following static initializer to your code:
static {
LogFactory.getFactory().setAttribute("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.NoOpLog");
}
6 comments:
didnt work for me...
what did work was:
create a new incorectness listener:
public class IncLis implements IncorrectnessListener {
@Override
public void notify(String arg0, Object arg1) {}
}
and add it to my webClient:
IncLis inclis = new IncLis();
webClient.setIncorrectnessListener(inclis);
Thanks, It worked for me.
Thanks Adam!
Worked perfectly!
webClient.setThrowExceptionOnFailingStatusCode(false);
webClient.setThrowExceptionOnScriptError(false);
+1 Worked like a charm!
Thank you! :)
Post a Comment