本文介绍了UI测试失败 - 无论是元素还是任何后代都没有将键盘焦点放在secureTextField上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的情况:

let passwordSecureTextField = app.secureTextFields["password"]
passwordSecureTextField.tap()
passwordSecureTextField.typeText("wrong_password") //here is an error



有什么问题?这适用于普通的 textFields ,但只有 secureTextFields 才会出现问题。任何解决方法?

What is wrong? This is working nice for normal textFields, but problem arise only with secureTextFields. Any workarounds?

推荐答案

这个问题给我带来了痛苦的世界,但我已经设法找到了一个合适的解决方案。在模拟器中,确保硬件 - >键盘 - >连接硬件键盘已关闭。

This issue caused me a world of pain, but I've managed to figure out a proper solution. In the Simulator, make sure 'Hardware -> Keyboard -> Connect hardware keyboard' is off.

这篇关于UI测试失败 - 无论是元素还是任何后代都没有将键盘焦点放在secureTextField上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-12 20:38