英文:
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap
问题
在创建一个新的 Selenium Java 项目并使用最新的 Selenium 版本(3.141.59)来自网站时,我遇到了以下异常:
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap
at org.openqa.selenium.remote.service.DriverService$Builder.<init>(DriverService.java:259)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.<init>(ChromeDriverService.java:101)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
at test.src.main(src.java:11)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableMap
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 5 more
英文:
So while creating a new selenium java project and using the latest selenium version (3.141.59) form the website, i encountered the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/collect/ImmutableMap
at org.openqa.selenium.remote.service.DriverService$Builder.<init>(DriverService.java:259)
at org.openqa.selenium.chrome.ChromeDriverService$Builder.<init>(ChromeDriverService.java:101)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:94)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:123)
at test.src.main(src.java:11)
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableMap
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
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
得分: 3
事实证明,在最新的 Selenium(3.141.59)下载中,我在 Selenium 网站上找不到独立的版本。相反,我的问题是通过手动将 client-combined-3.141.59.jar 和 lib 文件夹中的所有 jar 文件添加到项目的构建路径中来解决的。
英文:
It turn out that in the latest selenium (3.141.59) download available form the selenium website I couldn't find a standalone anymore.
Instead my problem was resolved by manually adding the client-combined-3.141.59.jar and all the jar files present in the lib folder to the Build Path of the project.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论