我想检查在我的 UITest 中是否有一个带有给定字符串的 tableViewCell.detailTextLabel
。问题是当我搜索 app.tables.cells.children(matching: .staticText)
时,它只会查找 tableViewCell.textLabel
的标签。
关于如何查询 detailTextLabel
有什么想法吗?
最佳答案
您可以尝试更通用的查询来确定文本是否存在。例如,如果您尝试断言某个单元格包含“123 Main St.”,您可以使用以下内容:
let app = XCUIApplication()
XCTAssert(app.staticTexts["123 Main St."]).exists)
当然,如果该文本出现在 textLabel
中,测试仍然会通过。
关于ios - 如何在 UITests 的 `detailTextLabel` 中访问 `tableViewCell`?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41966151/