Kev*_*OUX 2 xcode coded-ui-tests swift xcuitest
在我的 UI 测试中,我有这个XCUIElement:
XCUIApplication().staticTexts["SUBMIT ORDER"]
当我打印 debugDescription 时:
po print(XCUIApplication().staticTexts["SUBMIT ORDER"].debugDescription)
有两个元素匹配:
Find: Elements matching predicate '"SUBMIT ORDER" IN identifiers'
Output: {
StaticText, {{0.0, 623.0}, {375.0, 44.0}}, label: 'SUBMIT ORDER'
StaticText, {{0.0, 623.0}, {375.0, 44.0}}, label: 'SUBMIT ORDER'
}
Run Code Online (Sandbox Code Playgroud)
.tap()我的问题是:我怎样才能只在最后一个元素上制作 a ?
小智 7
您可以使用以下方法来完成:
XCUIApplication().staticTexts.matching(identifier: "SUBMIT ORDER").allElementsBoundByIndex.last
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1735 次 |
| 最近记录: |