Nightwatch:waitforElementVisible 上的意外令牌错误

Nightwatch : Unexpected Token Error on waitforElementVisible

当我尝试使用 node nightwatch tests/login_Radius_TC2.js 通过命令行执行下面的代码时,我一直遇到以下错误。我是守夜人的新手,需要帮助才能了解确切的根本原因。

我也查看了之前提出的问题,但其中 none 能够解决问题。不过,如果有一个问题已经回答了这个问题,请指导我。

我参考了 http://nightwatchjs.org/api/#waitForElementVisible 实施。

   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();
        }
    };

下面是错误信息:

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)

只需删除;来自代码

        '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();
        }
    };```