这是我的情况:
let passwordSecureTextField = app.secureTextFields["password"]
passwordSecureTextField.tap()
passwordSecureTextField.typeText("wrong_password") //here is an error
UI Testing Failure - Neither element nor any descendant has keyboard focus. Element:
怎么了?这对普通的 textFields
很有效,但只有 secureTextFields
才会出现问题。有什么解决方法吗?
最佳答案
这个问题让我很痛苦,但我已经设法找到了一个合适的解决方案。在模拟器中,确保关闭 I/O -> Keyboard -> Connect hardware keyboard
。
关于ios - UI 测试失败 - 元素和任何后代都没有键盘焦点在 secureTextField 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32184837/