【发布时间】:2019-04-03 17:02:58
【问题描述】:
我想从下面的列表中检索所有文本以创建帐户列表:
<ul class="ui-select-choices ui-select-choices-content ui-select-dropdown dropdown-menu ng-scope" ng-show="$select.open && $select.items.length > 0" repeat="tenant.id as tenant in tenants | filter:$select.search | orderBy: tenant.id" style="opacity: 1;">
<li class="ui-select-choices-group" id="ui-select-choices-16">
<div class="divider ng-hide" ng-show="$select.isGrouped && $index > 0"></div>
<div ng-show="$select.isGrouped" class="ui-select-choices-group-label dropdown-header ng-binding ng-hide" ng-bind="$group.name"></div>
<!-- ngRepeat: tenant in $select.items -->
<!-- ngIf: $select.open -->
<div ng-attr-id="ui-select-choices-row-{{ $select.generatedId }}-{{$index}}" class="ui-select-choices-row ng-scope active" ng-class="{active: $select.isActive(this), disabled: $select.isDisabled(this)}" role="option" ng-repeat="tenant in $select.items" ng-if="$select.open" ng-click="$select.select(tenant,$select.skipFocusser,$event)" id="ui-select-choices-row-16-0" style="">
<span class="ui-select-choices-row-inner" uis-transclude-append="">
<div ng-bind-html="tenant.name | highlight: $select.search" class="ng-binding ng-scope">RF-Account</div>
</span>
</div>
<!-- end ngIf: $select.open -->
<!-- end ngRepeat: tenant in $select.items -->
<!-- ngIf: $select.open -->
<div ng-attr-id="ui-select-choices-row-{{ $select.generatedId }}-{{$index}}" class="ui-select-choices-row ng-scope" ng-class="{active: $select.isActive(this), disabled: $select.isDisabled(this)}" role="option" ng-repeat="tenant in $select.items" ng-if="$select.open" ng-click="$select.select(tenant,$select.skipFocusser,$event)" id="ui-select-choices-row-16-1" style="">
<span class="ui-select-choices-row-inner" uis-transclude-append="">
<div ng-bind-html="tenant.name | highlight: $select.search" class="ng-binding ng-scope">RF-Account1</div>
</span>
</div>
<!-- end ngIf: $select.open -->
<!-- end ngRepeat: tenant in $select.items -->
<!-- ngIf: $select.open -->
<div ng-attr-id="ui-select-choices-row-{{ $select.generatedId }}-{{$index}}" class="ui-select-choices-row ng-scope" ng-class="{active: $select.isActive(this), disabled: $select.isDisabled(this)}" role="option" ng-repeat="tenant in $select.items" ng-if="$select.open" ng-click="$select.select(tenant,$select.skipFocusser,$event)" id="ui-select-choices-row-16-2">
<span class="ui-select-choices-row-inner" uis-transclude-append="">
<div ng-bind-html="tenant.name | highlight: $select.search" class="ng-binding ng-scope">RF-Account2</div>
</span>
</div>
<!-- end ngIf: $select.open -->
<!-- end ngRepeat: tenant in $select.items -->
<!-- ngIf: $select.open -->
<div ng-attr-id="ui-select-choices-row-{{ $select.generatedId }}-{{$index}}" class="ui-select-choices-row ng-scope" ng-class="{active: $select.isActive(this), disabled: $select.isDisabled(this)}" role="option" ng-repeat="tenant in $select.items" ng-if="$select.open" ng-click="$select.select(tenant,$select.skipFocusser,$event)" id="ui-select-choices-row-16-3">
<span class="ui-select-choices-row-inner" uis-transclude-append="">
<div ng-bind-html="tenant.name | highlight: $select.search" class="ng-binding ng-scope">RF-Account3</div>
</span>
</div>
<!-- end ngIf: $select.open -->
<!-- end ngRepeat: tenant in $select.items -->
</li>
</ul>
这是我的研究:
!Choisir un autre compte
Click Element selectTenant
${listAccount} Create List
${idDynamicAccountList} Get Element Attribute //li[@class='ui-select-choices-group'] id
${rest} ${group} Split String From Right ${idDynamicAccountList} - 1
${maxAccount} Get Element Count //li[@class='ui-select-choices-group']//span
:FOR ${i} IN RANGE 0 ${maxAccount}
\ ${accountXpath} Catenate SEPARATOR= //li[@id='${idDynamicAccountList}']//div[@id='ui-select-choices-row- ${group} - ${i} ']//span
\ ${accountName} Get Text ${accountXpath}
\ Append To List ${listAccount} ${accountName}
Log List ${listAccount}
最后,列表是空的。在我看来,问题一定来自使用关键字“获取文本”,但我不知道为什么。
请您帮我执行此操作好吗?
谢谢
【问题讨论】:
-
因为Stack Overflow 是我们旨在帮助解决编程问题的地方,这需要您投入一定的时间。这通常是通过提供您的特定技术问题的minimal reproducible example 来实现的。如果您通过阅读 help center 和 How to Ask 部分了解什么是好问题,这将有所帮助。
-
我完全理解。正是因为我一直在寻找前进的方法而做不到。你有一个小的方向可以走吗?
-
嗯,所以你的结果应该是一个包含 RF-Account,RF-Account1,RF-Account2,RF-Account3 的列表?能否提供您的机器人代码?
-
我添加了对我的工作 @A 的搜索。 Kootstra, Wojtek
标签: html list robotframework