Search code examples
javamavenseleniumwebdriverclassnotfound

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


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!


Solution

  • 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.