由于ng-app指令在html标记上,因此量角器抛出错误
Protractor throwing error now that ng-app directive is on html tag
最近,在我们正在开发的应用程序中,与我合作的开发人员将ng应用程序指令从body标记移到了html标记。我正在使用量角器构建端到端测试套件,因为我们目前使用的是Angular 1.4.8
在今天早上之前,我所有测试中的所有内容都成功运行了,但是现在ng-app指令在html标签上,我收到了以下错误。
/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/goog/async/nexttick.js:41
goog.global.setTimeout(function() { throw exception; }, 0);
^
Error while waiting for Protractor to sync with the page: "window.angular is undefined.
This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping.
See http://git.io/v4gXM for details"
我知道我需要在conf.js文件中定义rootElement:"html",下面是我的conf.js文档中的以下代码
exports.config = {
framework: 'jasmine2',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['helpers.e2e.js', 'specs/leases.spec.js', ],
baseUrl: 'http://test.manage.ourApp.com/',
rootElement: 'html',
capabilities: {
'browserName': 'chrome'
},
//This can be changed via the command line as:
//--params.login.user 'ourApp'
params: {
login: {
email: 'ourApp.test@gmail.com',
password: 'test'
}
},
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 300000,
isVerbose: true,
includeStackTrace: true
},
HTML代码看起来像这个
<html ng-app="ourApp" class="ng-scope">
我尝试了很多来自网络的建议,但仍然不明白我做错了什么。如有任何帮助,我们将不胜感激。
在protractor.conf.js
文件中,您应该将rootElement指定为一个选择器,该选择器将查找包含ng-app
属性的元素:
rootElement: '[ng-app="ourApp"]'
相关文章:
- 在量角器中创建一个.txt错误输出文件是手动的,而不是控制台错误
- 使用PhantomJS的量角器错误
- 量角器 - 错误:第二次使用相同的函数时索引越界异常
- 量角器自定义预期条件失败并显示错误
- 量角器如果(复选框.isSelected())错误
- 角量角器中的错误处理
- 量角器根据条件单击嵌套元素,错误 - 在指定的超时内未调用异步回调
- 处理量角器中的未知错误
- 量角器给出“无法启动 Web 驱动程序会话”错误
- 使用量角器网络驱动程序进行 Safari 历史记录导航的未知错误
- materializecss 日期选择器量角器(错误:元素在点处不可单击)
- 量角器未知错误,从 DOM 中删除属性
- 量角器由中继器命令中是否有错误
- 如何避免“;jasmine.suite()必需“;量角器中出现错误消息
- 由于ng-app指令在html标记上,因此量角器抛出错误
- 失败:未知错误:元素在点(x,x)-角度/量角器处不可单击
- 我能为量角器测试处理一个特殊的茉莉花错误吗
- 使用量角器和角度带模式测试登录对话框时发生超时错误
- 如何解决'这在您的系统上失败'量角器错误
- 量角器错误消息返回一个Object