Selenide: Error package org.openqa.selenium.phantomjs does not exist

Created on 27 Mar 2017  路  10Comments  路  Source: selenide/selenide

I use phantomjs.
For new version Selenide 4.4 i have error: package org.openqa.selenium.phantomjs does not exist .
For me this fix it work (i correct selenide-4.4.pom):

    <dependency>
      <groupId>com.codeborne</groupId>
      <artifactId>phantomjsdriver</artifactId>
      <version>1.4.1</version>
      <!--scope>runtime</scope-->
      <scope>compile</scope>
      <!--exclusions>
        <exclusion>
          <artifactId>selenium-java</artifactId>
          <groupId>org.seleniumhq.selenium</groupId>
        </exclusion>
        <exclusion>
          <artifactId>selenium-remote-driver</artifactId>
          <groupId>org.seleniumhq.selenium</groupId>
        </exclusion>
      </exclusions-->
    </dependency>
not a bug

Most helpful comment

@BabyRoot @darklynx Good morning! Selenide 4.4.1 is available via Maven: http://search.maven.org/#search%7Cga%7C1%7Cselenide

All 10 comments

Not very good correction
At me it is written:

INFO: Selenium WebDriver v. 3.1.0 build time: 2017-02-16 12:21:31 -0800

I delete dependency phantomjsdriver

      <groupId>com.codeborne</groupId>
      <artifactId>phantomjsdriver</artifactId>
      <version>1.4.1</version>

And have:

INFO: Selenium WebDriver v. 3.3.1 build time: 2017-03-10 09:10:29 +0000

and ChromeDriver works good. But i need phantomjsdriver.

I fixed problem:

  1. edit phantomjsdriver-1.4.1.pom:
    change versions for selenium-api and selenium-remote-driver on 3.3.1
  2. edit selenide-4.4.pom (chage scope on 'compile'):
      <groupId>com.codeborne</groupId>
      <artifactId>phantomjsdriver</artifactId>
      <version>1.4.1</version>
      <scope>compile</scope>

I can confirm that there is a conflict with transient dependencies in selenide ver. 4.4:

selenium-java ver. 3.3.1 wants selenium-api ver. 3.3.1 via different drivers, e.g. selenium-chrome-driver

whereas phantomjsdriver ver. 1.4.1 declares selenium-api ver. 3.1.0 as dependency, in my case 3.1.0 won and caused issues, so I had to explicitly declare selenium-api ver. 3.3.1 among dependencies.

I assume phantomjsdriver should be updated and point to the same version of selenium-api as other drivers.

@BabyRoot @darklynx That you for sharing. The problem is with Maven which resolves dependency selenium-api incorrectly.

Simple workaround:

add an explicit dependency to your pom.xml: org.seleniumhq.selenium:selenium-api:3.3.1

Explanation

Look, this is output of loved gradle dependencies:
```+--- com.codeborne:selenide:4.4
| +--- org.seleniumhq.selenium:selenium-java:3.3.1
| | +--- org.seleniumhq.selenium:selenium-chrome-driver:3.3.1
| | | --- org.seleniumhq.selenium:selenium-remote-driver:3.3.1
| | | +--- org.seleniumhq.selenium:selenium-api:3.3.1
...
| +--- com.codeborne:phantomjsdriver:1.4.1
| | --- org.seleniumhq.selenium:selenium-api:3.1.0 -> 3.3.1


And this is output of **hated** `mvn dependency:tree`:
```[INFO] +- com.codeborne:selenide:jar:4.4:test
[INFO] |  +- org.seleniumhq.selenium:selenium-java:jar:3.3.1:test
...
[INFO] |  +- com.codeborne:phantomjsdriver:jar:1.4.1:test
[INFO] |  |  \- org.seleniumhq.selenium:selenium-api:jar:3.1.0:test

Do you see it? Gradle uses newer selenium-api:3.3.1, but Maven uses older selenium-api:jar:3.1.0.

Do you still like Maven?.. :(

@BabyRoot @darklynx The problem is fixed in Selenide 4.4.1 (will appear in maven central repo within few hours).

@BabyRoot @darklynx Good morning! Selenide 4.4.1 is available via Maven: http://search.maven.org/#search%7Cga%7C1%7Cselenide

Error again for 4.4.1
i make scope <scope>compile</scope> - and problem fixed.

works fine in our project, the dependency now is properly resolved to version 3.3.1, since you have excluded all transient dependencies of phantomjsdriver library

but we are using selenide in test project, so test scope is properly picked up

thanks a lot!

I am facing such problem

tried to access class org.openqa.selenium.os.ExecutableFinder from class org.openqa.selenium.phantomjs.PhantomJSDriverService

Selenide v 4.4.1
Gradle

Was this page helpful?
0 / 5 - 0 ratings