HtmlUnit Javascript Engine – Do you need it?

The Rhino engine used by HtmlUnit is great but can be slow. If you are worried about performance you can ask yourself whether you really need it. You can always enable it if you need it.

These are the settings I am currently using which is quick enough for me a the moment.

public class HtmlUnitWebClient extends WebClient {

    public HtmlUnitWebClient() {

super.setIncorrectnessListener(new IncorrectnessListenerImpl() {
public void notify(String arg0, Object arg1) {
//do nothing

final SilentCssErrorHandler eh = new SilentCssErrorHandler();
setCookieManager(new CookieManager() {
protected int getPort(final URL url) {
final int r = super.getPort(url);
return r != -1 ? r : 80;



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s