简体   繁体   English

无法从Eclipse执行Webdriver Java代码

[英]Not able to execute a Webdriver Java Code from eclipse

I recently configured Web-driver in eclipse and also configured ant and I was able to execute a project. 我最近在eclipse中配置了Web驱动程序,还配置了ant,因此能够执行一个项目。 Recently I created 1 more project and wrote first Java code and when I click on run button , it is not able to execute it even though it has no errors. 最近,我又创建了一个项目并编写了第一个Java代码,当我单击run按钮时,即使它没有错误,它也无法执行。 Here is the error it is throwing when I try to execute. 这是我尝试执行时抛出的错误。

Class not found Dashboard
java.lang.ClassNotFoundException: Dashboard
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at     org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClass(RemoteTestRunner.java:693)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.loadClasses(RemoteTestRunner.java:429)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:452)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Make sure you have selenium-java-2.x.jar and JUnit/TestNG jar in you classpath. 确保您的类路径中有selenium-java-2.x.jar和JUnit / TestNG jar。 Also make sure your tests are in classpath. 还要确保测试在类路径中。 To set a classpath right Click on Project -> Properties -> Java Build Path -> "Add JARs" or "Add External JARs" . 要设置类路径,请右键单击Project-> Properties-> Java Build Path->“ Add JARs”或“ Add External JARs”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM