Selenium Actions Class cannot be resolved in selenium version greater then 3.1

Viewed 1793

We are using selenium 2.5.2 for our Java tests. And we decided that it is time to move forward to the latest selenium version (currently 3.14).

After downloading selenium 3.14 from https://www.seleniumhq.org/ and adding it to our project, some of the tests are having compilation problem

Actions cannot be resolved to a type.

I went to the import section of the class and I saw that the line import org.openqa.selenium.interactions.Actions is also having a compilation problem

The import org.openqa.selenium.interactions.Actions cannot be resolved.

I went to the loaded jar and I can see the class there.

So I took one more step and tried to decompile the class using DJ Java decompiler. When i tried to do this I got next error

Action violation at address...

I tried to decompile more classes from the jar and they all succeded. So I went to previous versions and figured out that in selenium version 3.2 they added internal class to Actions class BuiltAction.

Finally I went to version 3.1 and I was able to decompile the Actions class. I need help to solve this issue.

1 Answers

Ok so there was an answer before, but because two people asked the same/similar question, I just posted the same thing twice.

Anyhow, the duplicate answer was deleted by the mod, but I would have at least expected them to link you the other question after deleting the answer here. Alas, people are not perfect.

However since the other question was badly worded anyway, I have since deleted the answer off of the other post, and I have added in the answer here again.


Interactions Actions was moved from selenium-remote-driver to selenium-api.

I had the same issue and then noticed while I was using v3.14.0 for everything else, my selenium-api was on v3.12.0.

It worked after I explicitly set the version in my POM:

<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-api</artifactId>
  <version>3.14.0</version>
</dependency>

Hope it works for you.

Related