Upgrading the HTMLUnit Version for WebDriver with Maven Dependencies

Since HTMLUnit impressed me so much in my last run through of tests I wanted to see how the current version would perform.

I noticed that WebDriver 2.42.2 uses version 2.14 of HTMLUnit,  but the current version of HTMLUnit is 2.15. I wanted to try 2.15 and see if it made a difference.

I import the full selenium-server dependency since it makes life easy for me.

<dependency>
 <groupId>org.seleniumhq.selenium</groupId>
 <artifactId>selenium-server</artifactId>
 <version>2.42.2</version>
</dependency>

This brings in HTMLUnit 2.14.

To bring in 2.15, I have to add a dependency on HTMLUnit itself in my pom.xml. And, provided HTMLUnit versions are backwards compatible, I should be good to go.

In the pom.xml before I import selenium-server, I import HTMLUnit

<dependency>
 <groupId>net.sourceforge.htmlunit</groupId>
 <artifactId>htmlunit</artifactId>
 <version>2.15</version>
</dependency>

And when I run the tests against this version of HTMLUnit, I discover that a few more tests have failed.

Oh well, I guess the guys at SeleniumHQ know what they are doing, and the picked the best version.

But the point is – you can override the dependencies if you have a specific use case that needs it, or a clash in those dependencies.

 

 

 

 

This entry was posted in Maven, Selenium Simplified Blog. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *