sebradloff sebradloff - 1 year ago 193
iOS Question

UI Testing iOS, Selecting Secure Text Entry textField

I have password and password conf textFields that I have applied the "Secure Text Entry", to mask the password. However, when I run the UI tests, those fields can not be found getting "UI Testing Failure - No matches found for "password" TextField".

I'm attempting to select the fields like so:

let passwordTextField = app.textFields["password"]

and then it fails when try to tap:


Any ideas on how I can access the field?

Answer Source

As discussed in the comments, when accessing a secure text field use the secureTextFields selector.

let passwordTextField = app.secureTextFields["password"]
passwordTextField.typeText("my secure password")
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download