Am new to this PhantomjsDriver in selenium webdriver.I need to run my selenium scripts in server without GUI. Please can anybody tell me how to achieve this. I need a head's up from the start of how to configure Phantomjs Driver,usage in server and rest.Below is my selenium code which i run through GUI , now i have to run these cases in server without GUI. What modifications i have to do so hat i can achieve the above task.
public static void main(String[] args) throws IOException{
login =args[0];
user = args[1];
pwd = args[2];
TestListenerAdapter tla = new TestListenerAdapter();
TestNG testng = new TestNG();
testng.setOutputDirectory(args[3]);
testng.setTestClasses(new Class[] {
CreateMultiRecordTest.class, UpdateMultiRecordTest.class,
DeleteMultiRecordTest.class
});
testng.addListener(tla);
testng.run();
Finally after a weeks time i found a solution to configure PhantomJs for my framework.Here's the solution.
DesiredCapabilities cap = new DesiredCapabilities();
java.io.File f = new java.io.File("");
String path = f.getAbsolutePath()+"\\ghostdriver-master\\src\\main.js";
cap.setCapability(PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY,path);
driver = new PhantomJSDriver(cap);