Error handling 是哪条线导致了量角器错误?
量角器是否有办法在控制台日志中显示发生错误的行?我只是收到了这样的信息:Error handling 是哪条线导致了量角器错误?,error-handling,webdriver,jasmine,protractor,end-to-end,Error Handling,Webdriver,Jasmine,Protractor,End To End,量角器是否有办法在控制台日志中显示发生错误的行?我只是收到了这样的信息: Message: Failed: Cannot call method 'click' of undefined Stack: Error: Failed: Cannot call method 'click' of undefined at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:1
Message:
Failed: Cannot call method 'click' of undefined
Stack:
Error: Failed: Cannot call method 'click' of undefined
at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:104:16
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)
1 spec, 1 failure
很难确定我是否有这么多单击命令。我正在运行量角器1.8.0
这是我的量角器.conf.js
:
exports.config = {
framework: 'jasmine2',
seleniumAddress: 'http://11.111.1.11:4444/wd/hub',
multiCapabilities: [{
'browserName': 'chrome',
'chromeOptions': {
args: ['--test-type']
}
}],
specs: ['./tests/my_test/*_spec.js'],
onPrepare: function(){
global.EC = protractor.ExpectedConditions;
browser.manage().window().maximize();
var jasmineReporters = require('jasmine-reporters');
jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
consolidateAll: true,
filePrefix: 'tests_xmloutput',
savePath: './test_results_report'
}));
},
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 30000
}
};
完整的错误消息是:
Failures:
1) test name description
Message:
Failed: Cannot call method 'click' of undefined
Stack:
Error: Failed: Cannot call method 'click' of undefined
at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:104:16
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)
1 spec, 1 failure
Finished in 3.206 seconds
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1
HeaderNavigationPartialPage.myAppButton.click();
LeftNavigationPartialPage.myAppToolsLink.ERROR-ON-PURPOSE.click();
browser.wait(EC.elementToBeClickable(LeftNavigationPartialPage.myAppSearchLink), 10000);
LeftNavigationPartialPage.myAppSearchLink.click();
规范文件/测试的内容应为:
Failures:
1) test name description
Message:
Failed: Cannot call method 'click' of undefined
Stack:
Error: Failed: Cannot call method 'click' of undefined
at /usr/local/lib/node_modules/protractor/node_modules/jasminewd2/index.js:104:16
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/base.js:1582:15
at [object Object].webdriver.promise.ControlFlow.runInNewFrame_ (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:1654:20)
at notify (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/webdriver/promise.js:465:12)
1 spec, 1 failure
Finished in 3.206 seconds
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1
HeaderNavigationPartialPage.myAppButton.click();
LeftNavigationPartialPage.myAppToolsLink.ERROR-ON-PURPOSE.click();
browser.wait(EC.elementToBeClickable(LeftNavigationPartialPage.myAppSearchLink), 10000);
LeftNavigationPartialPage.myAppSearchLink.click();
以下是
量角器在发动机罩下使用的项目相关问题:
现在问题已经解决,jasmine升级到=2.3.1
您应该做的是将量角器升级到=2.1.0
旧答案:
作为一种解决方法,回到jasmine 1.x
:
exports.config = {
framework: 'jasmine',
...
}
嗯,我通常看到这种错误发生在哪条线上。在beforeach()
,afterEach()
中是否有任何click()
调用?没有。我特意重命名了一个元素变量,只是为了创建此错误。您能否显示您获得的完整输出并共享您正在使用的量角器配置?还有,您使用的量角器版本是什么?@alecxe是的,我会得到这些信息。给我一点时间。谢谢你的更新。另外,能否显示测试名称说明规范的内容?自2015年5月15日起,问题已解决-升级到量角器2.3.1包括修复。@Dr1Ku目前还没有量角器2.3.1,Julie指的是jasmine 2.3.1。但是,无论如何,谢谢你的观点-更新了答案。