2

I have defined `loginpage.js':

'use strict';

( function () {

var ptor;
var navigate = function () {
    //browser.ignoreSynchronization = true ;
    ptor = protractor.getInstance();
    ptor.ignoreSynchronization = true;
    ptor.waitForAngular();
    ptor.get('http://store.demoqa.com');
    //browser.get('http://store.demoqa.com/');
};

var login = function ( username, password ) {
    this.username.sendKeys( username );
    this.password.sendKeys( password );
    this.loginButton.click();
};

var LoginPage = function () {
    this.username     = dv.findElement( by.id( 'log' ) );
    this.password     = dv.findElement( by.id( 'pwd' ) );
    this.loginButton  = dv.findElement( by.id( 'login' ) );
};

LoginPage.prototype.navigate = navigate;
LoginPage.prototype.login    = login;

module.exports = LoginPage;

} )();

Then I call loginpage in spec.js

this.Before( function ( callback ) {

    var loginPage = new LoginPage();
    isAngularSite(false);
    loginPage.navigate();
    callback();

} );

But when I run the test, the following error displays:

c:\Users\binhlex\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108
  var template = new Error(this.message);
                 ^
NoSuchElementError: Unable to locate element: {"method":"id","selector":"log"}
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'HSSSC1PCL02018', ip: '192.168.197.24', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_60'
Driver info: driver.version: unknown
    at new bot.Error (c:\Users\binhlex\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\error.js:108:18)
    at Object.bot.response.checkResponse (c:\Users\binhlex\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\atoms\response.js:109:9)
    at c:\Users\binhlex\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver\webdriver.js:379:20
    at [object Object].promise.ControlFlow.runInFrame_ (c:/Users/binhlex/AppData/Roaming/npm/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:1857:20)
    at [object Object].goog.defineClass.notify (c:/Users/binhlex/AppData/Roaming/npm/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:2448:25)
    at [object Object].promise.Promise.notify_ (c:/Users/binhlex/AppData/Roaming/npm/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:564:12)
    at Array.forEach (native)
    at [object Object].promise.Promise.notifyAll_ (c:/Users/binhlex/AppData/Roaming/npm/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/../webdriver/promise.js:553:15)
    at goog.async.run.processWorkQueue (c:\Users\binhlex\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\goog\async\run.js:130:15)
    at process._tickDomainCallback (node.js:409:9)
[launcher] Process exited with error code 1

At this point, a browser opens but it does not open any url in address bar. Am I doing anything wrong while defining the pageobject and call to navigate function from loginpage?

My full code can be found here: https://stackoverflow.com/questions/33373738/protractor-cucumberjs-browser-get-does-not-work

closed as off-topic by IAmMilinPatel, Kate Paulk, bish, Helping Hands, Peter M. - stands for Monica Jan 26 '16 at 18:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about software development unrelated to testing are off-topic here, but can be asked on Stack Overflow." – IAmMilinPatel, Kate Paulk, bish, Helping Hands, Peter M. - stands for Monica
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I suggest changing your title to be more specific to the question you wish answered – ECiurleo Jan 20 '16 at 11:18

Browse other questions tagged or ask your own question.