0

I have added an accessibility identifier to a label so that I can use it in my UIAutomation javascript files. How do I access the text on the label using accessibility identifier?

Suppose "aLabel" is the accessibility identifier and my javascript function to access the text on that label is:

appLabelValue:function()
{
return this.getElement('aLabel').value();
}

I even tried replacing .value() with .text() in the above method but I am getting same error for both i.e. undefined is not a function.

Please suggest.

tech_human
  • 6,592
  • 16
  • 65
  • 107

1 Answers1

0

You access the values of UIElements by using name() try this

appLabelValue:function()
{
return this.getElement('aLabel').name();
}
Johan de Klerk
  • 2,515
  • 3
  • 25
  • 35
  • Tried that... I am getting the accessibilityIdentifier string back i.e. aLabel. What I want is suppose the label has a text say "MyLabel" and label's accessibility identifier is "aLabel", then using "aLabel", I want to get or access "MyLabel" text. – tech_human Jan 16 '13 at 17:15