iam getting an error in eclipse selenium Error: Unable to initialize main class samplePackage.WebDriverDemo Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/WebDriver
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Firstly, check properly if you have all important dependencies for your program.
Secondly, I had similar error while running maven project:
And this problem was because of inappropriate plugin, because I tested different versions of Selenium and it didn’t help me.
So when I changed
The issue was gone. The difference between plugins you can find here.
In addition, sometimes we upgrade our libraries even with same method name. Due this different in version, we get NoClassDefFoundError or NoSuchMethodError at runtime when one library was not compatible with such an upgrade.
Java build tools and IDEs can also produce dependency reports that tell you which libraries depend on that JAR. Mostly, identifying and upgrading the library that depends on the older JAR resolve the issue.