【发布时间】:2018-12-04 21:56:14
【问题描述】:
我在使用 RIDE 编辑器在机器人框架中测试我的应用程序时遇到以下错误。
找不到带有定位符'xpath: //*[contains(text(), "Applicant")]'的元素。
但我的 HTML 页面包含 Applicant 文本
当我使用“Applicant1”编辑该名称时,错误消失了。但我不能在我的应用程序中将其作为“Applicant1”。我希望 Applicant 在我的 HTML 页面中。
我正在为我的应用程序使用 Angular4。申请人来自侧面菜单,它来自 Cupa 菜单 npm 库 以下是显示我如何使用该申请人在 HTML 页面上显示的代码。
下面是.ts文件
menuItemsArray: any[] = [
{ 'title': 'Loan Application', 'link': 'loan-creation',
'subItems': [
{ 'title': 'Create Loan Application', 'link': 'loan-creation' },
{ 'title': 'List Of Loan Applications', 'link': 'list-of-loan-application' },
{ 'title': 'Loan Application Details', 'link': 'get-loan-details-by-id' },
]
},
{
'title': 'Applicant', 'link': 'applicant-creation',
'subItems': [
{ 'title': 'Create New Applicant', 'link': 'applicant-creation' },
{ 'title': 'List Of Applicants', 'link': 'list-of-consumer' },
]
}
];
下面是.html文件
<nav class="navbar navbar-expand-md top-navbar jh-navbar">
<cuppa-slidemenu name="cupaBar" [menulist]="menuItemsArray" [config]="menuConfig" (open)="onMenuOpen()" (close)="onMenuClose()" (onItemSelect)="onItemSelect($event)"></cuppa-slidemenu>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault"
aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="fa fa-navicon"></span>
</button>
请帮帮我
Click CreateApplicant
Click Element xpath: //*[contains(text(), "Applicant")]
我使用上面的代码点击“Applicant”文本。但它不起作用。名称为“Applicant” 它仅适用于“Applicant1”。此外,它还可以与贷款申请、创建贷款申请等其他选项一起使用。
【问题讨论】:
-
如果您为问题提供相关的 HTML 会很好
标签: html selenium robotframework angular4-forms