Instruments returning accessibility label values instead of displayed texts

Originator:danail.branekov
Number:rdar://16876192 Date Originated:10.05.2014
Status:Open Resolved:No
Product:Developer Tools Product Version:Instruments 5.1.1 (55045)
Classification: Reproducible:Always
 
Hi,
Using Xcode I have created a simple application with a UILabel and UIButton with the following properties
* Static label (UILabel)
    - Text: My Label
    - Accessibility enabled
    - Accessibility label: Accessibility Label Value
* Button (UIButton)
    - Text: My Button
    - Accessibility enabled
    - Accessibility label: Accessibility Button Value

Via instruments I am trying to get the texts which are actually displayed on the device/simulator. Here is the script:
var target = UIATarget.localTarget();
var window = target.frontMostApp().mainWindow();

var button = window.buttons()[0];
UIALogger.logDebug("Button label: " + button.label());
UIALogger.logDebug("Button name: " + button.name());
UIALogger.logDebug("Button value: " + button.value());

var staticText = window.staticTexts()[0];
UIALogger.logDebug("Static text label: " + staticText.label());
UIALogger.logDebug("Static text name: " + staticText.name());
UIALogger.logDebug("Static text value: " + staticText.value());

In the resulting log I can see that only the accessibility label is returned. Is this supposed to behave like this? Is it possible to actually get the displayed value from the script?

Thanks!

Steps to Reproduce:
1. Download the sample application APP attached
2. Start Instruments and choose the automation template
3. Select the APP as target
4. Create a new script with the following content

var target = UIATarget.localTarget();
var window = target.frontMostApp().mainWindow();

var button = window.buttons()[0];
UIALogger.logDebug("Button label: " + button.label());
UIALogger.logDebug("Button name: " + button.name());
UIALogger.logDebug("Button value: " + button.value());

var staticText = window.staticTexts()[0];
UIALogger.logDebug("Static text label: " + staticText.label());
UIALogger.logDebug("Static text name: " + staticText.name());
UIALogger.logDebug("Static text value: " + staticText.value());

5. Run the script and check the editor log

Expected Results:
I would expect that the label() method returns the value displayed on the screen as per UIAElement API specification

Actual Results:
The label() method returns the accessibility label value

Version:
Xcode 5.1.1 (5B1008)
Instruments 5.1.1 (55045)
OS X 10.9.2 (13C1021)

Notes:
A discussion on the topic can be found at https://devforums.apple.com/message/909855#909855 and http://answers.oreilly.com/topic/1646-how-to-use-uiautomation-to-create-iphone-ui-tests/

Configuration:
This is a general issue with the UIAElement implementation which does not depend on the configuration

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!