0

I am trying to run my webdriver test cases using ghostdriver (Phantomjs).I have a maven project ,OS - WIN8, Coding - JAVA 1.7 , Framework : testng6.8.7+maven3 and currently using the latest version of Selenium Webdriver i.e dependency in pom.xml file .

 <!-- Selenium Web Driver -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>2.43.1</version>
    </dependency>

I have tried few PhantomJs dependencies into the pom.xml file But its not compatible with latest version of Wendriver.

    <dependency>
        <groupId>com.github.klieber</groupId>
        <artifactId>phantomjs</artifactId>
        <version>1.9.2</version>
    </dependency>

I'm not able to import

  **import org.openqa.selenium.phantomjs.PhantomJSDriver;
  import org.openqa.selenium.phantomjs.PhantomJSDriverService;**

But using phantomJs version 1.0.4 , I'm able to import but that's giving error java.lang.NoClassDefFoundError: org/openqa/selenium/HasInputDevices

So what phantomjs version can i use that would be compatible with latest version of Selenium WebDriver.

Little bird
  • 1,106
  • 7
  • 28
  • 58
  • 1
    I can't find this artifact from my maven browser. I use `com.github.detro:phantomjsdriver:1.2.0` for this. It includes dependecies to the selenium libraries 2.41.0 – Artjom B. Sep 23 '14 at 09:00
  • You can also visit: http://stackoverflow.com/questions/36706663/phantomjs-version-compatibility-with-selenium/36769777#36769777 – Ripon Al Wasim Apr 22 '16 at 10:15

1 Answers1

2

com.github.klieber:phantomjs:1.x.x doesn't seem to be accessible anymore. You should use com.github.detro:phantomjsdriver:1.2.0:

<dependency>
    <groupId>com.github.detro</groupId>
    <artifactId>phantomjsdriver</artifactId>
    <version>1.2.0</version>
</dependency>

You can also use the slightly older 1.1.0 version

<dependency>
    <groupId>com.github.detro.ghostdriver</groupId>
    <artifactId>phantomjsdriver</artifactId>
    <version>1.1.0</version>
</dependency>

Version 1.2.0 depends on the 2.41.0 selenium libraries and version 1.1.0 has the 2.39.0 dependency.

The otherwise accessible com.github.klieber:phantomjs-maven-plugin:0.4 doesn't provide the classes PhantomJSDriver and PhantomJSDriverService.

Override dependencies of third party jar in maven shows a way to override the version of selenium libraries to use the latest one.

Community
  • 1
  • 1
Artjom B.
  • 61,146
  • 24
  • 125
  • 222
  • :- Yeah , Its working fine . But after using latest version i.e 1.2.0 . Tests are getting hanged up .Logs are :- [INFO - 2014-09-24T10:51:28.988Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW [INFO - 2014-09-24T10:56:28.986Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW [INFO - 2014-09-24T11:01:28.999Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW – Little bird Sep 24 '14 at 11:16
  • I can't help you with this one. – Artjom B. Sep 24 '14 at 11:20
  • 1
    You better to use phantomjsdriver 1.2.1 with latest Selenium version 2.53.0 . com.codeborne phantomjsdriver 1.2.1 – Ripon Al Wasim Apr 22 '16 at 10:07