iOS UI 测试点击表格的第一个索引 [英] iOS UI Testing tap on first index of the table
本文介绍了iOS UI 测试点击表格的第一个索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚开始学习 iOS 中的 UI 测试.当我按下记录并点击表格的第一个索引时,它会生成这样的代码.
I just started studying for UI testing in iOS. When I press record and tap on first index of the table, it generate codes like this.
XCUIApplication *app = [[XCUIApplication alloc] init];
[app.tables.staticTexts[@"Apr 04 16:28"] tap];
如果我的所有数据都是恒定的就好了.但这些文字会不时更改.如何修改这些代码,以便它始终点击表的第一个索引?
It is good if all my data are constant. But those text will be changed from time to time. How can I modify these code so that it will always tap on the first index of the table?
推荐答案
使用 -elementBoundByIndex
在您应用的 cells
上.
XCUIApplication *app = [[XCUIApplication alloc] init];
[[app.cells elementBoundByIndex: 0] tap];
这篇关于iOS UI 测试点击表格的第一个索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文