尝试运行此示例时Protractor Automation 当我在cmd中点击量角器conf.js时出现以下错误
exports.config = {
directConnect: true,
// Capabilities to be passed to the webdriver instance.
capabilities: {
'browserName': 'chrome'
},
// Framework to use. Jasmine is recommended.
framework: 'jasmine',
// Spec patterns are relative to the current working directly when
// protractor is called.
specs: ['joe_spec.js'],
// Options to be passed to Jasmine.
jasmineNodeOpts: {
defaultTimeoutInterval: 30000
}
};
C:\Users\Emna\Desktop\example>protractor conf.js
Using ChromeDriver directly...
[launcher] Running 1 instances of WebDriver
[launcher] Error: SyntaxError: Unexpected token ILLEGAL
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at C:\Users\Emna\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine\lib\jasmine.js:71:5
at Array.forEach (native)
at Jasmine.loadSpecs (C:\Users\Emna\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine\lib\jasmine.js:70:18)
[launcher] Process exited with error code 100
答案 0 :(得分:2)
在这里你可以复制,粘贴这个示例代码并运行它:
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);
});
});
});
问题是您在描述文件中使用的字符: 两个'和'都是狡猾的字符,它不喜欢..如果你用'和'替换它的工作......我只测试了两个,当我使用你的代码得到你得到的同样的错误信息..但是如果我改为'和'然后错误就消失了