Reputation: 230
I am trying to instantiate a PhantomJS Driver with Selenium Java. Below is the code :
File file = new File("C:\\Softwares\\drivers\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe");
System.setProperty("phantomjs.binary.path", file.getAbsolutePath());
WebDriver driver = new PhantomJSDriver();
driver.get("http://www.google.com");
I have tried with different versions of Selenium and I am getting the same exception :
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.HttpVerb
java.lang.NoClassDefFoundError: org/openqa/selenium/remote/HttpVerb
at org.openqa.selenium.phantomjs.PhantomJSDriver.getCustomCommands(PhantomJSDriver.java:166)
at org.openqa.selenium.phantomjs.PhantomJSCommandExecutor.<init>(PhantomJSCommandExecutor.java:62)
at org.openqa.selenium.phantomjs.PhantomJSDriver.<init>(PhantomJSDriver.java:110)
I'm using the below list of dependencies in my project :
The reason I'm using an outdated version of selenium library is due to some article I found over the internet saying that remote/HttpVerb is deprecated and downgrading the library would remove the error. However, I'm still getting this error
Upvotes: 0
Views: 515
Reputation: 4739
Please check this dependancy in POM
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
<version>2.53.1</version>
</dependency>
Check whether this class is present or not
Upvotes: 1