0

I have the given piece of code

textField.attributedPlaceholder = NSAttributedString(string: Strings.test,
                                                             attributes: [NSAttributedString.Key.foregroundColor: ColorTheme.test])

How I can set an accessibility identifier in attributedPlaceholder so that I can later use the containing string in the UITest?

RTXGamer
  • 3,215
  • 6
  • 20
  • 29
Straider
  • 13
  • 2

1 Answers1

1

You need to give accessibility identifier to your textfield. Then you can get the placeholder text via property.

let textField = XCUIApplication().textFields["textFieldIdentifier"]
let placeholderText = textField.placeholderValue
Gopito
  • 61
  • 6