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,490 points
18,611 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,500 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 29, 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, 2019 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,090 points
4,794 views
+1 vote
3 answers

Error occurred during initialization of boot layer java.lang.module.FindException: Module Selenium not found

This might probably be coz while creating ...READ MORE

answered Nov 27, 2019 in Selenium by Sirajul
• 59,230 points
59,611 views
+2 votes
3 answers

Selenium Webdriver + Java - Eclipse: java.lang.NoClassDefFoundError

I also faced this issue first time, ...READ MORE

answered Aug 28, 2019 in Selenium by Shraddha
71,808 views
0 votes
2 answers

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,500 points
13,673 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,142 views
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,910 points
7,221 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,874 views
+1 vote
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,500 points
8,356 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP