机器人框架显示。JavascriptException: 消息:javascript错误。无法使用"[ng-app]"找到根选择器。

问题描述 投票:0回答:1

我使用Robot框架,使用SeleniumLibrary和AngularJSLibrary。

我有一个没有Angular的登录页面,但后续页面有Angular。当我运行使用robotframework构建的端到端测试时,它连接了登录页面,但它什么也没做,而且失败了。

错误信息。

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
angularjs selenium robotframework
1个回答
0
投票

我也有这个问题。 我发现我的根选择器通过grepping在我的Angular src目录。

[devel@localhost src]$ grep selector . -r
./app/app.component.ts:  selector: 'app-root',

在你的AngularJSLibrary的.robot Library include中添加一个参数。

Library     AngularJSLibrary    root_selector=app-root 

注意 "AngularJSLibrary "后面的多个空格。 希望能帮到你。

© www.soinside.com 2019 - 2024. All rights reserved.