gpt4 book ai didi

ios - XCUITest 在页面上找不到元素

转载 作者:行者123 更新时间:2023-11-29 05:45:34 33 4
gpt4 key购买 nike

某些元素在 XCUITest 中不“可见”,无法为它们断言,它们从未被发现。即使我通过调试打印 XCUIApplication() ,元素也不会显示。

最佳答案

我发现如果你设置了

isAccessbilityElement = true

属性(我这样做是为了支持旁白),那么所有标记 View 的 subview 都将隐藏在 XCUITest 世界中。我的解决方案是检查我是否正在运行 UITests,如果是,则将 false 设置为此标志,如果没有,则设置 true

let application = XCUIApplication()
application.launchArguments = ["UITest"]
application.launch()

public var isRunningUITests: Bool {
return arguments.contains("UITest")
}

关于ios - XCUITest 在页面上找不到元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56169557/

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