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"]
but then it fails when I try to tap:
passwordTextField.tap()
Any ideas on how I can access the field?
As discussed in the comments, when accessing a secure text field use the secureTextFields
selector.
let passwordTextField = app.secureTextFields["password"]
passwordTextField.tap()
passwordTextField.typeText("my secure password")
Also if you need to type to secureTextField
If menu I/O Hardware Keyboard is ON typeText not working for secureTextField.
Use below to type to secure field
password.tap()
app.keys["t"].tap()
app.keys["e"].tap()
app.keys["s"].tap()
app.keys["t"].tap()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With