java.lang.NoClassDefFoundError:org/openqa/selenium/remote/SessionNotFoundException
我使用的是Firefox45.0,在java.lang.NoClassDefFoundError:org/openqa/selenium/remote/SessionNotFoundException,java,maven,selenium,Java,Maven,Selenium,我使用的是Firefox45.0,在pom.xml中添加的依赖项是 selenium firefox驱动程序2.53.0 java.lang.NoClassDefFoundError: org/openqa/selenium/remote/SessionNotFoundException at TestFIles_MDM.Test_Authn.setup(Test_Authn.java:27) Firefox和Chrome都出现了错误 如何解决此问题,它在上周起作用。我认为您在pom.
pom.xml
中添加的依赖项是
selenium firefox驱动程序2.53.0
java.lang.NoClassDefFoundError: org/openqa/selenium/remote/SessionNotFoundException
at TestFIles_MDM.Test_Authn.setup(Test_Authn.java:27)
Firefox和Chrome都出现了错误
如何解决此问题,它在上周起作用。我认为您在pom.xml中缺少此依赖项:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
</dependency>
org.seleniumhq.selenium
. 瞧,这对我很有效。刚刚更新了pom.xml中的selenium java依赖项
<!-- Selenium java-jar dependency -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.1</version>
</dependency>
org.seleniumhq.selenium
我在尝试将远程驱动程序从2.53.1更新到3.0.1时发生了这种情况。我刚把它恢复到2.53.1,它就消失了
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>2.53.1</version>
</dependency>
org.seleniumhq.selenium
selenium远程驱动程序
2.53.1
在项目中运行mvn依赖项:树
,并根据selenium远程驱动程序
检查哪些是可传递的
在我的项目中,我正确地依赖于seleniumjava
at2.53.1
,但另一个测试依赖性依赖于较旧的版本(2.40.0);这意味着我的测试在运行时使用了2.40.0
版本的selenium远程驱动程序
,这会导致java.lang.NoClassDefFoundError:org/openqa/selenium/remote/SessionNotFoundException
错误
如果您对selenium remote driver有可传递的依赖项,则有两个选项可以“修复”它们:
将依赖于旧版本的工件更新为
- 完全不依赖于工件,或者
- 使用最新版本
在pom.xml
的
部分中为selenium java
添加一个条目,以将工件固定在2.53.1
版本
这将影响项目和所有嵌套maven依赖项中的selenium java
版本;请注意,这些嵌套工件可能无法与最新版本配合使用
还值得一提的是seleniumjava
version2.53.0
存在Firefox不兼容问题;版本2.53.1
据称修复了该问题。有关更多详细信息,请参阅
希望这有帮助:)我也遇到了这个问题。我换成了下面的,它就消失了
<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>
org.seleniumhq.selenium
硒服务器
4.0.0-α-2
木卫一
java客户端
6.1.0
假如
您是否试图在关闭webdriver实例后关闭它,也许吧?看起来您的浏览器和webdriver版本不同步。我的pom.xml中也有这种依赖关系:org.seleniumhq.selenium服务器2.53.0 org.seleniumhq.selenium java 2.53.0应该足够了。尝试显式地包含selenium api依赖项,看看这是否有什么不同?也这样做了,但仍然没有运行。selenium api:2.39.0为什么不使用selenium api 2.53.0()