gpt4 book ai didi

ios - XCUIElement 点击不适用于自定义表格 View 单元格

转载 作者:行者123 更新时间:2023-11-30 13:31:44 26 4
gpt4 key购买 nike

我正在尝试为我的 iOS 应用程序编写 UI 测试。出于某种原因,我无法点击我的自定义表格 View 单元格。我正在尝试这样做:

let app = XCUIApplication()
let staticTextOfFirstCell = app.tables.cells.elementBoundByIndex(0)
.staticTexts.elementBoundByIndex(0)
staticTextOfFirstCell.tap()

staticTextOfFirstCell 已设置并且也存在。但是,我的测试用例仍处于等待应用程序空闲状态。

最佳答案

如果您使用 UIRefreshControl 尝试注释显示加载指示器,如果它工作正常并继续进行 UI 测试,则使用构建配置 if 语句显示它的包装如下所示:

    #if !TEST
if let refreshControl = refreshControl where !refreshControl.refreshing {
refreshControl.beginRefreshing()
}
#endif

这样,一旦您运行 UI 测试,它就不会执行此代码块。

请注意,您需要为 UI 测试添加构建配置。报告了一个雷达错误 here对于动画(我相信刷新控件也是如此)

关于ios - XCUIElement 点击不适用于自定义表格 View 单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36501981/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com