Re: [selenium-users] Looking for solution: NoClassDefFoundError

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: [selenium-users] Looking for solution: NoClassDefFoundError

⇜Krishnan Mahadevan⇝

You are missing the guava libraries. Not sure how you are managing your dependencies.

If you are using Maven, you can follow the instructions here : http://www.seleniumhq.org/download/maven.jsp

 

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Mike Frank <[hidden email]>
Reply-To: <[hidden email]>
Date: Monday, October 16, 2017 at 12:50 AM
To: <[hidden email]>, <[hidden email]>
Subject: [selenium-users] Looking for solution: NoClassDefFoundError

 

I am trying to run the script below on a Mac and I keep receiving a NoClassDefFoundError exception possibly due to the Chrome driver that I am using (I am assuming that is why I am getting an exception).

 

Details below:

 

Configuration

------------------

macOS Sierra v. 10.12.16

Selenium version: 3.6.0.

Chrome version: 2.33

 

SCRIPT

-----------

package tutorial6;

import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class FindElementsBy {

    public static void main(String[] args) throws Exception {
        System.setProperty("webdriver.chrome.driver","/Users/mike.frank/Selenium/selenium-java-3.6.0/chromedriver");
        WebDriver driver = new ChromeDriver();
        driver.get("http://newtours.demoaut.com");                     

        List<WebElement> objLinks = driver.findElements(By.tagName("a"));


        for (WebElement objCurrentLink : objLinks) {  
                String strLinkText = objCurrentLink.getText(); 
                System.out.println(strLinkText);           
        }

        driver.navigate().refresh();
        driver.close();
        driver.quit(); 
    }
}

 

 

RESULT

----------

Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Function
    at tutorial6.FindElementsBy.main(FindElementsBy.java:18)
Caused by: java.lang.ClassNotFoundException: com.google.common.base.Function
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
    ... 1 more

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/CAG-WgUypqiARc0VbUQASkh1Ke8FynatOU1-2Vqcsekqb6e_vHg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Selenium Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-developers/51F2FC32-D723-4ECB-9A48-8920F2007AAC%40gmail.com.
For more options, visit https://groups.google.com/d/optout.