1

I'm using Selenium and Maven to build a project in Eclipse and I'm getting the build error: Cannot find the class file for org.openqa.selenium.internal.Locatable.

I'm using Selenium-Server-Standalone 3.141.59, which I've noticed has the Locatable class under...

org.openqa.selenium.**interactions**.Locatable 

instead of...

org.openqa.selenium.**internal**.Locatable.

Is this a different class altogether?

How do I get Eclipse to recognize that the class is there?

Please find followings are my relevant dependencies from my Pom.xml

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>

    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-server</artifactId>
        <version>3.141.59</version>
    </dependency> 

    <dependency>
        <groupId>com.codeborne</groupId>
        <artifactId>selenide</artifactId>
        <version>2.3</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/com.codeborne/phantomjsdriver -->
    <dependency>
        <groupId>com.codeborne</groupId>
        <artifactId>phantomjsdriver</artifactId>
        <version>1.3.0</version>
    </dependency>               

    <!-- https://mvnrepository.com/artifact/junit/junit -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/log4j/log4j -->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

2 Answers 2

2

Remove Selenium Server from your dependencies.

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-server</artifactId>
    <version>3.141.59</version>
</dependency>

If I remember correctly you now need WebDriver, which is included in Selenium Java.

Include also Selenium API

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

and update selenide and phantomjsdriver

<dependency>
    <groupId>com.codeborne</groupId>
    <artifactId>selenide</artifactId>
    <version>5.1.0</version>
</dependency>

<dependency>
    <groupId>com.codeborne</groupId>
    <artifactId>phantomjsdriver</artifactId>
    <version>1.4.4</version>
</dependency>

The current version of selenide you're pulling in is 2.3, which will bring in selenium-java 2.33.0.

The current version of phantomjsdriver you're pulling in is 1.3.0, which will bring in selenium-java 2.53.0.

You need selenide 5.1.0 and phantomjsdriver 1.4.4

Sign up to request clarification or add additional context in comments.

1 Comment

I think removing it was the right idea. Unfortunately the error is still there. Any Idea what else could be causing it?
0

Is it a spring project? What is below solved my problem:

<dependency>
    <groupId>com.codeborne</groupId>
    <artifactId>selenide</artifactId>
    <version>5.2.4</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-api</artifactId>
    <version>3.141.59</version>
</dependency>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-remote-driver</artifactId>
    <version>3.141.59</version>
</dependency>
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-support</artifactId>
    <version>3.141.59</version>
</dependency>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.