Maven存储库中的selenium-api-3.0.1.jar中缺少Selenium WebDriver 3.0.1 Actions类 [英] Selenium WebDriver 3.0.1 Actions class missing from selenium-api-3.0.1.jar from Maven repository

查看:323
本文介绍了Maven存储库中的selenium-api-3.0.1.jar中缺少Selenium WebDriver 3.0.1 Actions类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在基于Maven的项目中使用Selenium WebDriver 3.0.1.此代码段失败(无法编译):

I am using Selenium WebDriver 3.0.1 in a Maven based project. This code snippet fails (does not compile):

Actions myActions = new Actions(myWebDriver);

因为从maven下载的selenium-api-3.0.1.jar中缺少org.openqa.selenium.interactions.Actions类. 这是pom.xml的相关部分:

because the org.openqa.selenium.interactions.Actions class is missing from the selenium-api-3.0.1.jar downloaded from maven. This is the relevant portion of the 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中测试了该替代依赖项:

I also tested this alternative dependency in 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类.

but in both cases the org.openqa.selenium.interactions.Actions class is missing from the downloaded selenium-api artifact.

使用grepcode.com搜索Maven存储库中的类,只会找到2.47.1或更早的版本.

Searching the class in Maven repository with grepcode.com finds only version 2.47.1 or older.

我下载了Selenium Client&直接从 http://www.seleniumhq.org/download/网址获得的WebDriver语言绑定zip软件包并且随附的client-combined-3.0.1-nodeps.jar文件确实包含org.openqa.selenium.interactions.Actions类.

I downloaded the Selenium Client & WebDriver Language Bindings zip package directly from the http://www.seleniumhq.org/download/ url and the included client-combined-3.0.1-nodeps.jar file does contain the org.openqa.selenium.interactions.Actions class.

似乎我缺少了一些东西……但是我真的不知道如何解决Maven依赖项.任何帮助都会被热情接受!

It seems that I am missing something ... but I really have no idea how to fix the Maven dependency. Any help will be enthusiastically accepted!

推荐答案

类似于org.openqa.selenium.interactions包(包括Actions类)的内容似乎已移至selenium-remote-driver.

Seems like the org.openqa.selenium.interactions package, including the Actions class, got moved to selenium-remote-driver.

您可以直接将依赖项添加到selenium-remote-driver,或者甚至更简单地将依赖项添加到selenium-java(取决于selenium-chrome-driver,而依赖于selenium-remote-driver).我会尝试使用后一个选项,因为这也应该使您摆脱许多其他显式依赖关系.

You can either add a dependency to selenium-remote-driver directly, or, even simpler, add a dependency to to selenium-java (that depends on selenium-chrome-driver which in turn depends on selenium-remote-driver). I would try to go with the latter option as this should allow you to get rid of a lot of other explicit dependencies as well.

这篇关于Maven存储库中的selenium-api-3.0.1.jar中缺少Selenium WebDriver 3.0.1 Actions类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆