I am using Firefox 45.0 and Dependency added in pom.xml
is
selenium-firefox-driver 2.53.0
.
java.lang.NoClassDefFoundError: org/open
I think you are missing this dependency in pom.xml:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
</dependency>
Check Selenium docs about Maven dependencies.
I ran into this too. I changed to the following and it went away.
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>4.0.0-alpha-2</version>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>6.1.0</version>
<scope>provided</scope>
</dependency>
Voila, It's worked for me.Just updated the selenium-java dependency in pom.xml
<!-- Selenium java-jar dependency -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
Or here is the link to get the updated version- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java
Run mvn dependency:tree
in your project, and check what is transitively depending on selenium-remote-driver
.
In my project, I was correctly depending on selenium-java
at 2.53.1
, but another test dependency was depending on an older version (2.40.0); that meant my tests were using the 2.40.0
version of selenium-remote-driver
at runtime, which causes the java.lang.NoClassDefFoundError: org/openqa/selenium/remote/SessionNotFoundException
error.
If you have transitive dependencies on selenium-remote-driver
, you have two options for "fixing" them:
Add an entry in your pom.xml
's <dependencyManagement>
section for selenium-java
to peg the artifact at version 2.53.1
.
This will affect the version of selenium-java
both in your project and all your nested maven dependencies, too; be aware that those nested artifacts may not work well with the latest version!
It's also worth mentioning that selenium-java
version 2.53.0
had a Firefox incompatibility problem; version 2.53.1
allegedly fixes that. See http://seleniumsimplified.com/2016/06/use_selenium_webdriver_jar_locally/ for more details.
Hope this helps :)
This happened with me while trying to update to remote driver to 3.0.1 from 2.53.1. I just reverted it back to 2.53.1 and it went away
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>2.53.1</version>
</dependency>