abd*_*yed 8 testing end-to-end angularjs protractor
当我执行 node elementexplorer.js http://127.0.0.1:8080/app/view1
我收到以下错误:
有一个webdriver错误:错误在等待Protractor与页面同步时出错:"root元素(正文)没有注入器.这可能意味着它不在ng-app中."
请告诉我如何提供rootelement选项.
目前,rootElement默认为body.如果您的身体中没有ng-app,则会出现该错误.它可以手动设置.
您需要更改rootElement.您可以通过运行以下命令直接从交互式视图中执
browser.rootEl = 'div#ng-app-located-here';
Run Code Online (Sandbox Code Playgroud)
假设您的ng-app位于 div#ng-app-located-here
在这种情况下,您需要指定您ng-app设置的元素.添加rootElement量角器conf.js,例如:
rootElement: 'div#nested-ng-app' // by default, it is 'body'
Run Code Online (Sandbox Code Playgroud)
仅供参考,这是因为量角器角特定的自定义定位器,象by.binding或by.model使用rootElement作为搜索根,从报价更改日志:
量角器的自定义定位器(by.binding,by.model等)使用config.rootElement作为其所有搜索的根.这意味着config.rootElement既用于指定如何获取Angular的注入器以及从何处开始搜索元素.这并不适用于所有情况,例如,如果应该搜索对话框中的元素,而不是ng-app的兄弟,而不是孩子.
| 归档时间: |
|
| 查看次数: |
5722 次 |
| 最近记录: |