参数列表后的量角器:错误:SyntaxError:missing)

时间:2016-01-19 16:46:03

标签: angularjs protractor

我正在尝试测试href链接。当我尝试运行我的量角器脚本时,我收到下面给出的错误消息。我经历了早期的解决方案,因为它可能是因为缺少括号但却无法找到任何遗漏。我是量角器的新手,有人可以指导我的代码出了什么问题。

test_spec.js

describe('test data collections link',function(){

    it("to click and test data collections link",funtion(){

        browser.get("http://localhost:7001/xxx/#/");

        element(by.id('dataCollection')).click();       
        expect(browser.getCurrentUrl()).toEqual("http://localhost:7001/xxx/#/dataCollection");
    });
});

conf.js

// An example configuration file.
exports.config = {
seleniumAddress: 'http://localhost:4444/wd/hub',

// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},



// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['test_spec.js'],

// Options to be passed to Jasmine.
jasmineNodeOpts: {
  showColors: true,
defaultTimeoutInterval: 30000
}
};
执行'protractor conf.js'时出现

错误:

[launcher] Error: SyntaxError: missing ) after argument list
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:414:25)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at C:\Users\gsr\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine\lib\jasmine.js:63:5
at Array.forEach (native)
at Jasmine.loadSpecs (C:\Users\gsr\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine\lib\jasmine.js:62:18)

1 个答案:

答案 0 :(得分:2)

有一个错字。它不是funtion,应该是function

describe('test data collections link',function(){
    //                                        HERE v
    it("to click and test data collections link",funtion(){

        browser.get("http://localhost:7001/xxx/#/");

        element(by.id('dataCollection')).click();
        expect(browser.getCurrentUrl()).toEqual("http://localhost:7001/xxx/#/dataCollection");
    });
});