java.lang.ClassNotFoundException: okhttp3.ConnectionPool - Selenium Error

+1 vote

Below is my simple Selenium Test Code:

public static void main(String[] args) {

    System.setProperty("webdriver.chrome.driver", "/home/chromedriver");
    WebDriver driver= new ChromeDriver();

    driver.get("http://google.com");
}

And still i get an error: 

Exception in thread "main" java.lang.NoClassDefFoundError: okhttp3/ConnectionPool | Caused by: java.lang.ClassNotFoundException: okhttp3.ConnectionPool
Mar 30, 2018 in Selenium by Shubham
• 13,300 points
3,138 views

3 answers to this question.

0 votes
Best answer
The only reason for ClassNotFoundException is if your JARS are not right. First download the latest jar files from here: https://www.seleniumhq.org/download/. Also download the latest ChromeDriver. Update Chrome to the latest version supported by the chromedriver. And make sure the JARS are added appropriately. Then you should be fine.

Do let me know if this works.
answered Mar 30, 2018 by nsv999
• 5,110 points

selected May 16, 2018 by Sudhir
Doesn't work
which version of Selenium Jars, & chromedriver are you using?
+1 vote

okhttp-3.10.0.jar & okio1.14.1.jar may be solve using this jar files your problem java.lang.NoClassDefFoundError: okhttp3/ConnectionPool

answered Aug 28, 2018 by Surendra Patil
Thanks Surendra. Never knew there was a JAR file named like these. Let's hope @shubhamsinha's error is solved.

Hello Surendra.

I'm getting below error after adding the okhttp-3.10.0.jar & okio1.14.1.jar file into my project.

:- java.lang.NoClassDefFoundError: org/apache/commons/exec/Executor

0 votes
give a full path for system property and escape the slash used
answered Jan 14 by Sourabh

Related Questions In Selenium

0 votes
1 answer

Java.lang.CharSequence cannot be resolved error while using sendKeys() using Selenium Webdriver

You could try this, myElement .sendKeys(new String[] { ...READ MORE

answered Apr 4, 2018 in Selenium by Johnathon
• 9,080 points
744 views
0 votes
3 answers
0 votes
3 answers

java.lang.IllegalStateException Error after adding set property webdriver

/* System.setProperty("WebDriver.gecko.driver", "C:\\Users\\DELL\\Desktop\\GeckoDriver1\\geckodriver.exe"); WebDriver driver = new FirefoxDriver(); */ ...READ MORE

answered May 1 in Selenium by anonymous
3,928 views
0 votes
1 answer
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,110 points
918 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
1,104 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
840 views
0 votes
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,110 points
2,266 views