XCUIElement TextField value returns placeholderValue

Originator:rich.ellis
Number:rdar://34505268 Date Originated:9/18/2017
Status:Duplicate Resolved:
Product:Xcode 9 GM Product Version:Version 9.0 (9A235)
Classification: Reproducible:Always
 
Summary:
In Xcode 9, the `value` of a TextField XCUIElement is returning the `placeholderValue` when the text field is empty. This is different from Xcode 8, where `value` was empty.

Steps to Reproduce:
In my app code, I am setting the `attributedPlaceholder` property on my UITextField instance.

In my UI test, this should pass:
let textField = XCUIApplication().textFields["address_line_1"]
let stringValue = textField.value as? String ?? ""
XCTAssertTrue(stringValue.isEmpty) // FAILS

Expected Results:
`value` of a TextField element should be the user-entered value, not the placeholder value.

Actual Results:
`value` is the same as `placeholderValue` when no text has been entered by the user.

Version/Build:
Xcode 9 GM -- Version 9.0 (9A235)

Configuration:
Running in "iPhone SE" simulator

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!