HtmlUnit driver error



  • I just started using HTML unit driver and when trying to run the application I get this error message in Eclipse. Do I miss something in my installation ?

    Exception in thread "main" org.openqa.selenium.WebDriverException: java.lang.IllegalArgumentException: Cannot locate declared field class org.apache.http.impl.client.HttpClientBuilder.dnsResolver
    Build info: version: '2.53.0', revision: '35ae25b', time: '2016-03-15 16:57:40'
    System info: host: 'Gigavoice-PC', ip: '10.19.241.138', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.7.0_60'
    Driver info: driver.version: HtmlUnitDriver
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:534)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:508)
    at automationFramework.CheckRedirects.main(CheckRedirects.java:24)
    Caused by: java.lang.IllegalArgumentException: Cannot locate declared field class org.apache.http.impl.client.HttpClientBuilder.dnsResolver
    at org.apache.commons.lang3.Validate.isTrue(Validate.java:155)
    at org.apache.commons.lang3.reflect.FieldUtils.readDeclaredField(FieldUtils.java:512)
    at com.gargoylesoftware.htmlunit.HttpWebConnection.getField(HttpWebConnection.java:1036)
    at com.gargoylesoftware.htmlunit.HttpWebConnection.createConnectionManager(HttpWebConnection.java:959)
    at com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnection.java:165)
    at com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(WebClient.java:1351)
    at com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1268)
    at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:381)
    at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:303)
    at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:450)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.get(HtmlUnitDriver.java:519)
    ... 2 more 
    


  • You probably have a wrong version of the Apache httpclient library in your classpath. See here: https://sourceforge.net/p/htmlunit/bugs/1786/


Log in to reply
 

Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2