【发布时间】:2017-07-07 18:01:27
【问题描述】:
我在一个基于 Maven 的项目中使用 Selenium WebDriver 3.0.1。此代码 sn-p 失败(无法编译):
Actions myActions = new Actions(myWebDriver);
因为从 maven 下载的 selenium-api-3.0.1.jar 中缺少 org.openqa.selenium.interactions.Actions 类。 这是 pom.xml 的相关部分:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-firefox-driver</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-support</artifactId>
<version>3.0.1</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-htmlunit-driver</artifactId>
<version>2.52.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>2.31.0</version>
</dependency>
我还在 pom.xml 中测试了这个替代依赖:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>3.0.1</version>
</dependency>
但在这两种情况下,下载的 selenium-api 工件中都缺少 org.openqa.selenium.interactions.Actions 类。
使用 grepcode.com 在 Maven 存储库中搜索类只能找到 2.47.1 或更低版本。
我直接从http://www.seleniumhq.org/download/ url 下载了 Selenium Client & WebDriver Language Bindings zip 包,其中包含的 client-combined-3.0.1-nodeps.jar 文件确实包含 org.openqa.selenium.interactions.Actions 类。
似乎我遗漏了一些东西......但我真的不知道如何修复 Maven 依赖项。任何帮助都会被热情地接受!
【问题讨论】:
标签: java maven selenium webdriver classnotfound