javanoob
javanoob

Reputation: 6410

NoClassDefFoundError: org/apache/http/conn/SchemePortResolver - Selenium

I have the below code for selenium

    public static void main(String[] args) {

    File file = new File("C:\\path\\IEDriverServer.exe");

    System.setProperty("webdriver.ie.driver", file.getAbsolutePath());

    WebDriver driver = new InternetExplorerDriver();

    driver.get("http://hedtq01vr.bcbsma.com:8080/tm/index.jsp?default");

    driver.quit();

}

When i try to run it fails with the below error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/conn/SchemePortResolver

Below are the jars on the build path:

and IEDriverServer.exe on the C:\path folder

Why am i getting this error..The page here doesn't talk anything about the required libraries.

Any suggestions?

EDIT:

After adding the libraries from the selenium folder, I am getting the below error:

Exception in thread "main" java.lang.NoSuchFieldError: INSTANCE

Here is the complete error link

Upvotes: 0

Views: 9451

Answers (1)

NotSoOldNick
NotSoOldNick

Reputation: 593

The Selenium download comes as a ZIP file (selenium-java-2.42.2.zip), which contains not only Selenium-java-2.42.2.jar, but also a sub-directory named 'libs', and which contains a whole raft of JAR libraries that the Selenium jar presumably relies on. Among others the libs folder contains httpclient-4.3.2.jar, which is the Apache HTTP component containing the class your current setup cannot find. Add all the jars in the libs directory on your build path (and then on your classpath at runtime), and you should be sorted.

Upvotes: 2

Related Questions