0
votes

Im using Mac laptop, I got this from youtube for mac tutorial, but its working for other students

Forgive me I am new to selenium

Not sure if Im missing somethingPicture of the exception

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

public class Main { public static void main(String [] args) {

    System.setProperty("webdriver.chrome.driver","/Users/c054148/Downloads/chromedriver");
    WebDriver obj = new ChromeDriver();
    obj.get("https://www.google.com");
}

} Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap at org.openqa.selenium.remote.service.DriverService$Builder.(DriverService.java:259) at org.openqa.selenium.chrome.ChromeDriverService$Builder.(ChromeDriverService.java:101) at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:123) at Main.main(Main.java:8) Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableMap at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 5 more

1
Does this answer your question? Why am I getting a NoClassDefFoundError in Java?maio290
It seems like you have not added some dependency jars. See if there are any additional files to be included into the project.Deepak Kumar

1 Answers

1
votes

Seems you have missed the extension of the ChromeDriver. It should be chromedriver.exe

 System.setProperty("webdriver.chrome.driver","/Users/c054148/Downloads/chromedriver.exe");