我如何提供“根元素"?交互测试量角器时的选项 [英] How do i supply "rootelement" option while testing protractor interatively
问题描述
当我执行node elementexplorer.js http://127.0.0.1:8080/app/view1
我收到以下错误:
有一个网络驱动程序错误:等待量角器时出现错误错误 与页面同步:根元素(主体)没有注入器.这可能与 表示它不在ng-app中."
There was a webdriver error: Error Error while waiting for Protractor to sync with the page: "root element (body) has no injector. this may mean it is not inside ng-app."
请让我知道如何提供rootelement
选项.
Please let me know how to provide the rootelement
option.
推荐答案
目前,rootElement默认为body.如果您体内没有ng-app,则会收到该错误.可以手动设置.
At the moment, rootElement defaults to body. If you don't have your ng-app in the body, you will get that error. It can be set manually tho.
您需要更改rootElement.您可以通过运行以下命令直接从交互式视图中完成此操作:
You need to change the rootElement. You can do it directly from the interactive view by running:
browser.rootEl = 'div#ng-app-located-here';
假设您的ng-app位于div#ng-app-located-here
Assuming that your ng-app is located at div#ng-app-located-here
这篇关于我如何提供“根元素"?交互测试量角器时的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!