我用下面的conf文件设置了量角器:
exports.config = {
framework: 'mocha',
rootElement: '#container1',
specs: ['*container1_spec.js'],
capabilities: {
browserName: 'chrome',
version: '',
platform: 'ANY'
},
onPrepare: function() {
// implicit and page load timeouts
browser.manage().timeouts().pageLoadTimeout(40000);
browser.manage().timeouts().implicitlyWait(25000);
}
}应用程序是手动引导角度的,当应用程序通过执行一个将控件转移到另一个应用程序时,我需要在执行一些步骤之后更改根元素。启动的第二个应用程序也是一个执行手动引导的角形应用程序。
来自another thread in SO。我找到了我可以做browser.rootEl = 'div#container2';的代码
WebDriverError: unknown error: [ng:test] no injector found for element argument to getTestability
http://errors.angularjs.org/1.5.8/ng/test 发布于 2016-09-28 17:10:57
正如我在问题中提到的,更改rootEl不起作用。我不得不求助于DOM来运行测试。
function getMessage() {
return document.getElementById('msg').textContent;
}
setTimeout(function() {
browser.executeScript(getMessage).then(function (txt) {
chai.expect(txt).to.equal("Error occured");
done();
});
}, 10000);browser.executeScript是允许我查询DOM和解决方法的关键函数。我必须为延迟添加一个超时,以允许第二个应用程序下载和引导。
https://stackoverflow.com/questions/39736158
复制相似问题