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: <seleniu...@googlegroups.com> on behalf of Mike Frank <myke...@gmail.com>
Reply-To: <seleniu...@googlegroups.com>
Date: Monday, October 16, 2017 at 12:50 AM
To: <selenium-...@googlegroups.com>, <seleniu...@googlegroups.com>
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 selenium-user...@googlegroups.com.
To post to this group, send email to seleniu...@googlegroups.com.
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.