๐Ÿ“ฆ SeleniumHQ / htmlunit-driver

WebDriver compatible driver for HtmlUnit headless browser.

โ˜… 262 stars โ‘‚ 90 forks ๐Ÿ‘ 262 watching โš–๏ธ Apache License 2.0
๐Ÿ“ฅ Clone https://github.com/SeleniumHQ/htmlunit-driver.git
HTTPS git clone https://github.com/SeleniumHQ/htmlunit-driver.git
SSH git clone git@github.com:SeleniumHQ/htmlunit-driver.git
CLI gh repo clone SeleniumHQ/htmlunit-driver
Ronald Brill Ronald Brill 4.40.0 020907b 35 minutes ago ๐Ÿ“ History
๐Ÿ“‚ master View all commits โ†’
๐Ÿ“ docs
๐Ÿ“ src
๐Ÿ“„ .gitattributes
๐Ÿ“„ .gitignore
๐Ÿ“„ .travis.yml
๐Ÿ“„ checkstyle.xml
๐Ÿ“„ howto.txt
๐Ÿ“„ LICENSE
๐Ÿ“„ pom.xml
๐Ÿ“„ README.md
๐Ÿ“„ README.md

HtmlUnitDriver Logo

Version 4.39.0 / December 07, 2025

HtmlUnitDriver is a WebDriver compatible driver for the HtmlUnit headless browser.

Maven Central Version

:heart: Sponsor

News

Developer Blog

HtmlUnit@mastodon | HtmlUnit@bsky | HtmlUnit@Twitter

Build Status

HtmlUnit Remote - Selenium 4 Grid support

Please have a look at the HtmlUnit Remote project if you like to use this driver from Selenium 4 Grid.

Get it!

An overview of the different versions, the HtmlUnit version used in each case and the compatibility can be found in these tables.

Maven

Simply add a dependency on the latest htmlunit3-driver version available in the Maven Central repository.

Add to your pom.xml:

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>htmlunit3-driver</artifactId>
    <version>4.39.0</version>
</dependency>

Gradle

Add to your build.gradle:

implementation group: 'org.seleniumhq.selenium', name: 'htmlunit3-driver', version: '4.39.0'

Usage

Simple

You can simply use one of the constructors from the HtmlUnit driver class

// simple case - no javascript support
WebDriver webDriver = new HtmlUnitDriver();

// specify the browser - no javascript support
WebDriver webDriver = new HtmlUnitDriver(BrowserVersion.FIREFOX);

// simple case - javascript support enabled
WebDriver webDriver = new HtmlUnitDriver(true);

// specify the browser - javascript support enabled
WebDriver webDriver = new HtmlUnitDriver(BrowserVersion.FIREFOX, true);

Customization

HtmlUnit offers many customization options. Similar to the other WebDriver implementations, the HtmlUnitDriverOptions class can be used to customize your HtmlUnit driver.

final HtmlUnitDriverOptions driverOptions = new HtmlUnitDriverOptions(BrowserVersion.FIREFOX);

// configure e.g.
driverOptions.setCapability(HtmlUnitOption.optThrowExceptionOnScriptError, false);

HtmlUnitDriver webDriver = new HtmlUnitDriver(driverOptions);
// use the driver

NOTE: Complete details for the HtmlUnitDriverOptions class can be found here.

Selenium compatibility

An overview of the different versions, the HtmlUnit version used in each case and the compatibility can be found in these tables.

License

HtmlUnitDriver is distributed under Apache License 2.0.

Development Tools

Special thanks to:

JetBrains IntelliJ IDEA JetBrains for providing IntelliJ IDEA under their open source development license and

Eclipse Foundation Eclipse Foundation for their Eclipse IDE

SmartGit to Syntevo for their excellent SmartGit!