Selenium 3.0.x with HTMLUnitDriver

I have selenium-java 3.0.1 in my Maven project. I read that this version does not come bundled with HTMLUnitDriver. So, I separately included selenium-htmlunit-driver 2.52.0 in my pom (latest version is available). However, when I do this, in the test run, I get the following exception:

org.openqa.selenium.WebDriverException: java.lang.IllegalArgumentException: cannot find the declared class of the org.apache.http.impl.client.HttpClientBuilder.sslcontext field

According to this link, including the dependencies of selenium-java and selenium-htmlunit driver, should be sufficient. In some scenarios, you might need to enable a stand-alone server, which is not suitable for my project. I tried 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.http 4.4.1 components. When I use these versions, everything works correctly.

So my question is: can HTMLUnitDriver not be used at all with Selenium 3.0.x? Or is my understanding completely wrong here?

+5
source share
1 answer

Selenium has changed the artifact identifier. 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

0
source

Source: https://habr.com/ru/post/1259475/


All Articles