Reputation: 13
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?
Upvotes: 0
Views: 466
Reputation: 61
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
Upvotes: 1