Friday, May 1, 2015

Protractor on PhantomJS                                                                             


Install phantomJs using npm

First step is to install phanmJs

> npm install -g phantomjs

Go to npm location
In this step move to the NPM_LOCATION(folder where npm is installed at your system.

check the path of phantomJs.It should be

"NPM_LOCATION\node_modules\phantomjs\lib\phantom\phantomjs.exe


Change  in conf.js


// conf.js  in windows
exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['specs.js'],
  capabilities: {
    'browserName': 'phantomjs' ,
    'phantomjs.binary.path': 'NPM_LOCATION/npm/node_modules/phantomjs/lib/phantom/phantomjs.exe'
    }

// spec.js
describe('Protractor Demo App', function() {
  it('should have a title', function() {
    browser.get('http://juliemr.github.io/protractor-demo/');
    expect(browser.getTitle()).toEqual('Super Calculator');
  });
}); 

Now run   protractor conf.js

Make sure that the path for phantomjs.binary.path always should be in  above format or for windows system  use  xxx\\yyy\\zzz\\

Note: Make sure you restart server by -->webdriver-manager start

No comments:

Post a Comment