SeleniumHQ / htmlunit-driver

WebDriver compatible driver for HtmlUnit headless browser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HtmlUnitDriver Logo

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

Maven Central

News

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.

Add to your pom.xml:

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

Gradle

Add to your build.gradle:

implementation group: 'org.seleniumhq.selenium', name: 'htmlunit3-driver', version: '4.23.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's the class HtmlUnitDriverOptions 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

Please check the

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.

About

WebDriver compatible driver for HtmlUnit headless browser.

License:Apache License 2.0


Languages

Language:Java 100.0%