I have selenium-java 3.0.1 in my Maven project. I have read that this version does not come packaged with HTMLUnitDriver. So, I have separately included selenium-htmlunit-driver 2.52.0 in my pom (the latest version available). However, when I do this, I get the following exception on test run:
org.openqa.selenium.WebDriverException: java.lang.IllegalArgumentException: Cannot locate declared field class org.apache.http.impl.client.HttpClientBuilder.sslcontext
According to this link, including the selenium-java and selenium-htmlunit-driver dependencies should be sufficient. In some scenarios, the standalone server may need to be included as well, which is not the case for my project. I tried it anyway, and that didn't work either.
selenium-htmlunit-driver 2.52.0 is internally dependent on org.apache.httpcomponents 4.5.1.
selenium-java 2.47.0 uses htmlunit-driver 2.47.0 which uses org.apache.httpcomponents 4.4.1. When I use these versions, everything works correctly.
So my question is, can HTMLUnitDriver not be used with Selenium 3.0.x at all? Or is my understanding completely wrong here?
HtmlUnitDriver is headless driver providing non-GUI implementation of Selenium WebDriver. It is based on HtmlUnit, fastest and light-weight browser implemented in Java.
HTML UnitDriver is the most light weight and fastest implementation headless browser for of WebDriver. It is based on HtmlUnit. It is known as Headless Browser Driver. It is same as Chrome, IE, or FireFox driver, but it does not have GUI so one cannot see the test execution on screen.
htmlunit driver does not support screenshots · Issue #1361 · SeleniumHQ/selenium-google-code-issue-archive · GitHub. This repository has been archived by the owner. It is now read-only.
What Is HtmlUnitDriver? HtmlUnitDriver is headless browser you could launch with Selenium Web Driver, meaning that it’s a browser without a user interface. Such browsers have many advantages, like taking less resources, since they don’t have to render the web elements visually on the screen.
HtmlUnitDriver is headless driver providing non-GUI implementation of Selenium WebDriver. It is based on HtmlUnit, fastest and light-weight browser implemented in Java. Test execution using HtmlUnitDriver is very fast.
Test execution using HtmlUnitDriver is very fast. Since, it is the fastest implementation of Selenium WebDriver. Being headless and fast, it is an ideal choice for web scrapping. Its browser – htmlUnit is Java-based.
HtmlUnit Driver is a well known Headless Browser driver. HtmlUnit Driver is similar to the other drivers such as Mozilla Firefox, Google Chrome, Internet Explorer but you couldn’t see the GUI of Html UnitDriver. You can create a HtmlUnitWebDriver as shown below
Selenium has changed artifact id. Use htmlunit-driver instead.
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>htmlunit-driver</artifactId>
<version>2.23.2</version>
</dependency>
See also: https://github.com/SeleniumHQ/htmlunit-driver
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With