Tuesday, April 04, 2017

How to run Selenium Test case with JAVA using browserless platform i.e. Phantomjs

Step 1:- First download Phantomjs.exe from the given path
Step 2:- Download the required phantomjsdriver-1.2.1.jar for our Selenium project and keep the same into Selenium Project lib folder and project classpath.

Step 3:- Create below given capabilities and provide the same capabilities to WebDriver using PhantomJSDriver
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "C:\\Software\\phantomjs-2.1.1-windows\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe");
WebDriver driver = new PhantomJSDriver(caps);
Note: You can also try for HrmlUnitDriver 
Refer this site for more information

No comments: