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

前端 未结 5 1547
离开以前
离开以前 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条回答
  •  梦毁少年i
    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 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 :)

提交回复
热议问题