没有为 getTestability 的元素参数找到注入器 [英] No injector found for element argument to getTestability

查看:13
本文介绍了没有为 getTestability 的元素参数找到注入器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试针对我自己的 AngularJS 代码运行 本教程.我无法通过第一次测试.任何从我的页面中提取任何信息的尝试都会出现此错误:

I'm trying to run this tutorial against my own AngularJS code. I can't get past the first test. Any attempt to pull any information from my page gets this error:

     Error: Error while waiting for Protractor to sync with the page: "[ng:test] no injector found for element argument to getTestability
http://errors.angularjs.org/1.3.8/ng/test"
   Stacktrace:
     Error: Error while waiting for Protractor to sync with the page: "[ng:test] no injector found for element argument to getTestability
http://errors.angularjs.org/1.3.8/ng/test"
    at Error (<anonymous>)
==== async task ====

Protractor.waitForAngular()
==== async task ====
Asynchronous test function: it()

有没有人提供 Protractor 教程,向您展示如何定位自己的代码,而不是其他人的代码?

Does anyone have a Protractor tutorial that shows you how to target your own code, rather than someone else's code?

提前谢谢你

推荐答案

答案是必须有 在您的 html 页面顶部,以便使用 Protractor.

The answer is that you must have <html ng-app> or <html ng-app = ""> at the top of your html page in order to use Protractor.

例如,将应用程序作为 <div ng-app = ""> 的一部分是行不通的

Having an app as part of a <div ng-app = "">, for example, will not work

这篇关于没有为 getTestability 的元素参数找到注入器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆