我将获得一个“线程中的异常”main .lang。NoClassDefFoundError:org/openqa/selenium/WebDriver”

时间:2021-02-06 19:38:39

I have added selenium-standalone.jar & selenium-java.jar but still I am getting the following exception when running the basic program,

我有添加selenium-standalone。jar和selenium-java。但是当我运行基本程序时,仍然会遇到以下异常,

Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver (wrong name: org/openqa/selenium/Webdriver) at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:791) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:423) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:356) at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2442) at java.lang.Class.getMethod0(Class.java:2685) at java.lang.Class.getMethod(Class.java:1620) at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:488) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:480)

线程“main”java.lang中的异常。NoClassDefFoundError:org/openqa/selenium/WebDriver(错误的名字:在java.net. classloader . definecl .定义中,在java.net.net.urlclassloader中,在java.net.URLClassLoader. defineclass (URLClassLoader.java:449)上,在java.net.URLClassLoader. $1 $1 $1.run(URLClassLoader.java:361)上,在java.net.URLClassLoader$1.run(URLClassLoader.java:355)上,在java.security.AccessController中,$1 $1运行(URLClassLoader.java:361)。在java.net.URLClassLoader.findClass(URLClassLoader.java:354)在java.lang.ClassLoader.loadClass(ClassLoader.java:423)上,在java.lang.ClassLoader.loadClass(ClassLoader.java: 308)上的java.lang.Class. loadclass (ClassLoader.java:356)。在java.lang. lang. class .private . getdeclaredmethods (Class.java:2442)在java.lang.Class.getMethod0(Class.java:2685)在java.lang. lang. class . getmethod (Class.java:1620)在sun. launcher.launcher.launcherhelhelhelhelre . launder . get20188 . main方法(launhelhelperrun - run - run .java:

Please provide the solution with proper steps to resolve this

请给解决方案提供适当的步骤来解决这个问题

2 个解决方案

#1


1  

This is where a dependency manager (like Maven) can help you, versus manual copying of libs.

这是依赖项管理器(如Maven)可以帮助您的地方,而不是手动复制libs。

org.openqa.selenium.WebDriver can be found in selenium-api-<version>.jar

org.openqa.selenium。可以在selenium-api- .jar中找到WebDriver

You will likely also need: selenium-remote-driver-<version>.jar and probably also selenium-support-<version>.jar, in addition to the selenium-java-<version>.jar you already have.

您可能还需要:selenium-remote-driver- <版本> 。jar和可能也有selenium支持—— <版本> 。jar,除了selenium-java- 。jar。

#2


0  

I am expecting good to use only one either standalone or java specific jars. Please give try by using only selenium-server-standalone-2.xx.0.jar i hope its works fine.

我希望只使用一个独立的或java特定的jar。请使用selenium-server- standard - one-2.xx.0进行试用。我希望它的工作顺利。

If you are trying to use java specific jars please provide all jars in downloaded zip file instead only that selenium-java.jar file. If you add all jar files in downloaded zip i hope this issue will resolved.

如果您试图使用java特定的jar,请提供下载的zip文件中的所有jar,而不是只提供selenium-java。jar文件。如果您在下载的zip中添加所有jar文件,我希望这个问题能够得到解决。

Thank You, Murali

谢谢你,Murali

#1


1  

This is where a dependency manager (like Maven) can help you, versus manual copying of libs.

这是依赖项管理器(如Maven)可以帮助您的地方,而不是手动复制libs。

org.openqa.selenium.WebDriver can be found in selenium-api-<version>.jar

org.openqa.selenium。可以在selenium-api- .jar中找到WebDriver

You will likely also need: selenium-remote-driver-<version>.jar and probably also selenium-support-<version>.jar, in addition to the selenium-java-<version>.jar you already have.

您可能还需要:selenium-remote-driver- <版本> 。jar和可能也有selenium支持—— <版本> 。jar,除了selenium-java- 。jar。

#2


0  

I am expecting good to use only one either standalone or java specific jars. Please give try by using only selenium-server-standalone-2.xx.0.jar i hope its works fine.

我希望只使用一个独立的或java特定的jar。请使用selenium-server- standard - one-2.xx.0进行试用。我希望它的工作顺利。

If you are trying to use java specific jars please provide all jars in downloaded zip file instead only that selenium-java.jar file. If you add all jar files in downloaded zip i hope this issue will resolved.

如果您试图使用java特定的jar,请提供下载的zip文件中的所有jar,而不是只提供selenium-java。jar文件。如果您在下载的zip中添加所有jar文件,我希望这个问题能够得到解决。

Thank You, Murali

谢谢你,Murali