I’m trying to access the value() of a UIAStaticText (a UILabel in the objective C code) JavaScript object. I can set the value just fine using setValue() and I can confirm that the simulator updates the text, but when I try to get the value I only get null.
i.e.
text.setValue("new text");
updates the label to “new text” in the simulator.
text.value()
still returns null after I’ve set the value.
What am I doing wrong here?
Looks like the root of the problem is in
accessibilityValueproperty ofUILabelreturningaccessibilityLabel, not theUILabeltext as it should. To solve this problem I overrideaccessibilityValueproperty in my customUILabelcategory.Besides this minor trick, I always try to prefer accessibility Identifier over accessibility Label to prepare my UI elements for automated testing. Check out “Accessibility Label and Identifier Attributes” section of Instruments New Features User Guide.