Step 1:- First download Phantomjs.exe from the given path
http://phantomjs.org/
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.setJavascriptEnabled(true);
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);
caps.setJavascriptEnabled(true);
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
http://www.guru99.com/selenium-with-htmlunit-driver-phantomjs.html
Refer this site for more information
http://www.guru99.com/selenium-with-htmlunit-driver-phantomjs.html
No comments:
Post a Comment