I am trying to do this: http://www.softwareishard.com/blog/firebug/automate-page-load-performance-testing-with-firebug-and-selenium/
Below is the screenshot taken from eclipse
package com.stack.tests;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
public class PerformanceTesting {
public static void main(String[] args) {
FirefoxProfile profile = new FirefoxProfile();
WebDriver driver = new FirefoxDriver(profile);
driver.quit();
} }
Below is the error code taken while running:
E:\stackoverflow\src\test\java\com\stack\tests>javac -cp selenium-serv
er-standalone-2.52.0.jar PerformanceTesting.java
E:\stackoverflow\src\test\java\com\stack\tests>set classpath=%classpat
h%;.;
E:\stackoverflow\src\test\java\com\stack\tests>java -cp .;selenium-ser
ver-standalone-2.52.0.jar PerformanceTesting
Exception in thread "main" java.lang.NoClassDefFoundError: PerformanceTesting (w
rong name: com/stack/tests/PerformanceTesting)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access100ドル(Unknown Source)
at java.net.URLClassLoader1ドル.run(Unknown Source)
at java.net.URLClassLoader1ドル.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 sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Does somebody know how to fix it?
-
I see com.stackovfl.tests in the eclipse excerpt and com/stack/tests in the error code. Might that be part of the problem?user246– user2462016年03月02日 21:26:05 +00:00Commented Mar 2, 2016 at 21:26
-
I changed it. I added wrongly. It was my company name so changed it to stack overflow.Deepak Nath– Deepak Nath2016年03月03日 03:33:36 +00:00Commented Mar 3, 2016 at 3:33
-
1Have you added the Selenium Standalone JAR file to your JAVA project?IAmMilinPatel– IAmMilinPatel2016年09月06日 03:37:30 +00:00Commented Sep 6, 2016 at 3:37
3 Answers 3
Have you added the Selenium Standalone JAR to your Java Project in Eclipse?
In Eclipse,
- Expand your project
- Right click on Referenced Libraries.
- Point to Build Path
- Select Configure Build Path
- In the dialog box that appears remove any old libraries, add new ones and check and make sure you have added Selenium JAR.
Once you have added the required libraries to the project try running again. It should solve the problem.
This exception is occur only when selenium-server-standalone-2.52.0.jar
is not added or the path is not correct. Please add selenium-server-standalone-2.52.0.jar
again or set your path again.
Method1: Try to add GUAVA jar in your build path. please go through the link for this jar https://github.com/google/guava/wiki/Release23
If you are using MAVEN project have that dependency please go through the link for this dependency https://mvnrepository.com/artifact/com.google.guava/guava/16.0.1
Method2: Add your jars into the classpath Location:JRE-LIB-EXT(place your jars here) Now jre will call all these jars automatically. Add your all external jars such as selenium jars under class path not module path