Reputation: 1088
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.
Upvotes: 0
Views: 3188
Reputation: 61962
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.
Upvotes: 2