java.lang.NoClassDefFoundError: org/openqa/selenium/remote/SessionNotFoundException

前端 未结 5 1505
离开以前
离开以前 2021-01-13 17:34

I am using Firefox 45.0 and Dependency added in pom.xml is selenium-firefox-driver 2.53.0.

java.lang.NoClassDefFoundError: org/open         


        
相关标签:
5条回答
  • 2021-01-13 17:57

    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.

    0 讨论(0)
  • 2021-01-13 17:58

    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>
    
    0 讨论(0)
  • 2021-01-13 18:00

    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

    0 讨论(0)
  • 2021-01-13 18:05

    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:

    1. Update the artifact that's depending on the older version to either
      • Not depend on the artifact at all, or
      • Use the latest version.
    2. 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 :)

    0 讨论(0)
  • 2021-01-13 18:09

    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>
    
    0 讨论(0)
提交回复
热议问题