示例-spec.js:
describe('Enter text in element on Protractor Example page', function() {
it ('to check that text entered in text box displays on page',function() {
browser.get('http://www.joecolantonio.com/ProtractorExample.html');
element(by.model('joeAngularText')).sendKeys('Joe Colantonio');
element(by.binding('joeAngularText')).getText().then(function(text){
console.log(text);
browser.pause();
});
});
});
配置文件:
exports.config = {
seleniumAddress : 'http://localhost:4444/wd/hub',
capabilities : {
'browserName' : 'chrome'
},
specs : [ 'example_spec.js' ],
jasmineNodeOpts : {
onComplete : null,
isVerbose : false,
showColors : true,
includeStackTrace : true
}
};
当我尝试从eclipse执行上述脚本时,这是错误 节点版本:v6.10.1 量角器版本5.1.1
*D:\gdfgdf\Selenium\protractor\WS\Protractor\node_modules\protractor\built\logger.js:75
info(...msgs) {
^^^
SyntaxError: Unexpected token ...
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:313:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (D:\sdfds\Selenium\protractor\WS\Protractor\node_modules\protractor\built\configParser.js:5:18)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)*
答案 0 :(得分:0)
用Eclipse NodeJs文件替换已安装的新版本的nodeJs文件。在Windows中,转到nodeJs安装C:\eclipse-jee-neon-3-win32-x86_64(1)\eclipse\plugins\tern.eclipse.ide.server.nodejs.embed.win32.win32.x86_64_1.2.0.201606160856\node-v4.2.4-win32-x86_64
的位置,并用最新的替换它