angularjs - 机器人框架显示:JavascriptException:消息:javascript 错误:无法使用“[ng-app]”找到根选择器
问题描述
我正在使用机器人框架并使用 SeleniumLibrary 和 AngularJSLibrary。
我有一个没有角度的登录页面,但后续页面有角度。当我运行使用机器人框架构建的端到端测试时,它会启动登录页面,但它什么也没做并且失败了。
错误信息:
JavascriptException: Message: javascript error: Unable to find root selector using "[ng-app]"
.
Please refer to the AngularJS library documentation for more information on how to resolve this error.
*** Settings ***
Documentation "Angular demo".
... Demo.
Library SeleniumLibrary
Library AngularJSLibrary
*** Keywords ***
Click clients and all accounts
Wait for Angular
Click Element binding=::item.title | translate
Click Element xpath=//*[@id="clientsMenu"]/li[1]/button
Account page is displayed
Title Should be All-Accounts
Search an account
Input Text model=vm.searchDetails.searchString 123
解决方案
我也有这个问题。我通过 grepping 在我的 Angular src 目录中找到了我的根选择器。
[devel@localhost src]$ grep selector . -r
./app/app.component.ts: selector: 'app-root',
将参数添加到您的 .robot 库包括 AngularJSLibrary:
Library AngularJSLibrary root_selector=app-root
注意“AngularJSLibrary”之后的多个空格。我希望这有帮助。
推荐阅读
- ssh - 如何获取有关 LDAP 问题的警报
- c++ - C++ 使用 map 比较字符串中的每个单词
- vue.js - Vuex Store - 从状态存储中获取数据以供查看
- java - Apache Camel:如何迭代列表并调用rest api?
- python - 在具有多个 python 版本的 Ubuntu 18.04 中卸载所有 Python 包
- python - Python BigQuery:插入内容为数字的字符串失败
- c - C 如何正确存储 sqlite3 行数据?
- ubuntu-16.04 - Ejabberd 19 在安装时抛出“deps/.got”异常
- javascript - 如何提交从php生成的多个表单
- automated-tests - 如何在 Visual Studio 2019 中单独运行选定的测试