You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can simply use one of the constructors from the HtmlUnit driver class
// simple case - no javascript supportWebDriverwebDriver = newHtmlUnitDriver();
// specify the browser - no javascript supportWebDriverwebDriver = newHtmlUnitDriver(BrowserVersion.FIREFOX);
// simple case - javascript support enabledWebDriverwebDriver = newHtmlUnitDriver(true);
// specify the browser - javascript support enabledWebDriverwebDriver = newHtmlUnitDriver(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.
finalHtmlUnitDriverOptionsdriverOptions = newHtmlUnitDriverOptions(BrowserVersion.FIREFOX);
// configure e.g.driverOptions.setCapability(HtmlUnitOption.optThrowExceptionOnScriptError, false);
HtmlUnitDriverwebDriver = newHtmlUnitDriver(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.
About
WebDriver compatible driver for HtmlUnit headless browser.