Zontar
Zontar

Reputation: 73

Build Error: Cannot find the class file for org.openqa.selenium.internal.Locatable

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>

Upvotes: 1

Views: 8437

Answers (2)

Douglas Ramos
Douglas Ramos

Reputation: 91

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>

Upvotes: 0

LppEdd
LppEdd

Reputation: 21154

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

Upvotes: 2

Related Questions