小编niv*_*000的帖子

线程“主”中的异常java.lang.NoClassDefFoundError:org / openqa / selenium / WebDriver

我在pom.xml中添加了最新的Selenium依赖项

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.7.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

我使用pom.xml在目录内运行了mvn clean install,并且根据Selenium文档,我还在应用程序类中导入了正确的类。

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试运行主方法时,出现以下错误

Exception in thread "main" java.lang.NoClassDefFoundError: 
org/openqa/selenium/WebDriver
Run Code Online (Sandbox Code Playgroud)

我查看我的〜/ .m2 / repository文件夹,但没有看到openqa文件夹,但看到了seleniumhq文件夹。

为什么maven不安装openqa文件夹,为什么文档说要从org.openqa导入...当我的jar存储库中不存在该文件时。我很困惑,我只想在本地存储库中成功导入Selenium Webdriver。

java selenium maven selenium-webdriver

5
推荐指数
3
解决办法
1万
查看次数

标签 统计

java ×1

maven ×1

selenium ×1

selenium-webdriver ×1