Selenium WebDriver 3.0.1 Actions class missing from selenium-api-3.0.1.jar from Maven repository

邮差的信 提交于 2019-12-11 06:18:16

问题


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);

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>

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>

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

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

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.

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!


回答1:


Seems like the org.openqa.selenium.interactions package, including the Actions class, got moved to 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.



来源:https://stackoverflow.com/questions/42310996/selenium-webdriver-3-0-1-actions-class-missing-from-selenium-api-3-0-1-jar-from

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!