【发布时间】:2019-09-23 21:26:29
【问题描述】:
我使用的是 NativeScript 6.1.1,并且我有一个 RadListView,我希望在其中的每一行都有唯一的引用。我正在考虑的一种方法是,如果我可以获得一个索引字段,那么我可以拥有带有以下内容的“automationText”字段
name0
name1
name2
这是我当前的模板;
<RadListView automationText="listing"
[items]="dataItems"
[filteringFunction]="filterItems"
pullToRefresh="true"
(pullToRefreshInitiated)="onPullToRefreshInitiated($event)">
<ng-template tkListItemTemplate let-item="item">
<StackLayout orientation="vertical">
<GridLayout class="itemContainer" rows="50,*" columns="*,100">
<Label automationText="name" row="0" col="0" class="nameLabel" [text]="item.name"></Label>
</GridLayout>
</StackLayout>
</ng-template>
</RadListView>
有可能做这样的事情吗?
<Label automationText="name#{index}" row="0" col="0" class="nameLabel" [text]="item.name"></Label>
【问题讨论】:
-
您可以通过 xpath 获取项目列表并单击特定索引。
标签: appium nativescript