When I am trying to execute below piece of code through command line using node nightwatch tests/login_Radius_TC2.js
I keep on getting below error. I am new to nightwatch and need help in understanding the exact root cause.
I also looked at the previously asked questions but none of them were able to solve the issue. Still if there is a question which already answers this, please guide me to it.
I referred the http://nightwatchjs.org/api/#waitForElementVisible for implementation.
module.exports = {
'LoginRadiusGoogleLogin' : function (client) {
client
.url('https://lr-candidate-demo1.hub.loginradius.com/auth.aspx')
.maximizeWindow();
.waitForElementVisible('span[title=Sign up with Google]', 10000)
.click('span[title=Sign up with Google]')
.windowHandles(function(result) {
console.log(result.value);
var newWindow=result.value[1];
this.switchWindow(+newWindow);
}
.end();
}
};
Below is the error message :
TEST FAILURE: 1 error during execution 0 tests failed, 0 passed. 1.834s
Unexpected token .
.waitForElementVisible('span[title=Sign up with Google]', 10000)
^
SyntaxError: Unexpected token .
at new Script (vm.js:84:7)
at createScript (vm.js:264:10)
at Object.runInThisContext (vm.js:312:10)
at Module._compile (internal/modules/cjs/loader.js:684:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:20:18)