1
public static void main(String[] args) throws IOException {
    RbnRunner runner = new RbnRunner();
    runner.run();

}

public void run() throws IOException {

    System.setProperty("webdriver.chrome.driver", "/Users/me/samples/Adam_milford/src/chromedriver");

    WebDriver driver = new ChromeDriver();

but when I want to init a headless selenium driver instead of Chrome driver, the code failes:

public static void main(String[] args) throws IOException {
    WebDriver driver = new HtmlUnitDriver();

why is that?

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/impl/conn/PoolingClientConnectionManager
    at com.gargoylesoftware.htmlunit.HttpWebConnection.createHttpClient(HttpWebConnection.java:536)
    at com.gargoylesoftware.htmlunit.HttpWebConnection.getHttpClient(HttpWebConnection.java:500)
    at com.gargoylesoftware.htmlunit.HttpWebConnection.setUseInsecureSSL(HttpWebConnection.java:711)
    at com.gargoylesoftware.htmlunit.WebClient.setUseInsecureSSL(WebClient.java:1096)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.createWebClient(HtmlUnitDriver.java:263)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.<init>(HtmlUnitDriver.java:129)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.<init>(HtmlUnitDriver.java:172)
    at org.openqa.selenium.htmlunit.HtmlUnitDriver.<init>(HtmlUnitDriver.java:168)
    at RbnRunner.run(RbnRunner.java:40)
    at RbnRunner.main(RbnRunner.java:28)
Caused by: java.lang.ClassNotFoundException: org.apache.http.impl.conn.PoolingClientConnectionManager
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 10 more
Elad Benda2
  • 13,852
  • 29
  • 82
  • 157
  • Usually, the actual problem is the one shown at the `Caused By:` line; a `ClassNotFoundException`. In case there are several `Cause By:` clauses, focus on the last one. – SJuan76 Oct 11 '16 at 08:32

1 Answers1

0
org.apache.http.impl.conn.PoolingClientConnectionManager

Isn't available... Do you have the library somewhere ?

Zorglube
  • 664
  • 1
  • 7
  • 15