"value" property should be the text of textual instances of XCUIElement

Originator:fellipe.caetano4
Number:rdar://22450555 Date Originated:2015-27-08
Status:Open Resolved:No
Product:Xcode Product Version:7.0 beta 6
Classification:Enhancement Reproducible:Always
 
Summary:
While writing a test case using the new UI Testing tools, I found myself in the following situation:

- I want to use a form to add an object to a collection of a data backing a table view;

- I want to make sure that the new row representing the object renders the data I just input in the form;

To achieve this, I queried the table view for the recently added row, then I queried the row for the static text that rendered the data. It would be very useful if the "value" property gave me the contents of a static text element (or other textual elements such as a text field or a text view). If there was another property that could be explicitly used to retrieve the text, even better.

Steps to Reproduce:
1. Write a UI test case
2. Retrieve a static text XCUIElement
3. Try to get the text content of the element

Expected Results:
I expected to be able to have a String storing the text content of the static text element I retrieved.

Actual Results:
I got an empty String when I accessed the "value" property of the static text element.

Version:
Xcode 7.0 beta 6

Comments

I was able to find a way of doing this, though as far as I can tell it is not officially documented by Apple.

In Swift: element.value as! String

If you do not force the cast you do not get the correct value.

By dexterlohnes at Sept. 3, 2016, 5:30 p.m. (reply...)

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!