gpt4 book ai didi

ios - Xcode UI 测试 UIKeyInput typeText

转载 作者:搜寻专家 更新时间:2023-10-31 19:30:12 25 4
gpt4 key购买 nike

在 Xcode UI 测试期间,如何为符合 UIKeyInputUIView insertText

我创建了一个 CodeInputView符合 UIKeyInput

当我记录自己手动输入代码时,Xcode writes app.typeText("1234") .

但是,当我尝试回放时,出现错误 UI Testing Failure - Neither element nor any descendant has keyboard focus .而且,该问题的所有解决方案均无效。

最佳答案

我找到了 UIKeyInput 的解决方案。请使用:

app.keys["1"].tap()
app.keys["2"].tap()
app.keys["3"].tap()
app.keys["4"].tap()

// Instead of app.typeText("1234")

关于ios - Xcode UI 测试 UIKeyInput typeText,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35740068/

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