iOS Accessiblity Label overwrites display text? Now cannot getText() correctly

I am adding accessibility fields in our ios project for automation purpose. Now I am encountering a hard situation:

e.g. e.g. a button with display text (“Login”) I assign following accessibility value for it:
accessibility label: btnLabel
accessibility identifier: btnId

This setting won’t affect the display text (the text is “Login”) of course. but now in Appium inspector, I cannot find the display text anymore, because it is overwrite by the accessibility fields (previously the “Login” text was displayed in “label” field)

name: btnId type: UIAButton value: label: btnLabel enabled: true visible: false valid: true location: {302, 619} size: {71, 48} xpath: //UIAApplication[1]/UIAWindow[1]/UIATabBar[1]/UIAButton[5]

Now here is the problem:

  • i cannot find the element by its text anymore
  • if i call getText() on the button element object, it will get “btnLabel” rather than “Login”

Seems the “Login” text is disappeared from appium’s radar… is there anyway I can get the display text or find the element by the display text?? Thanks!!

Accessibility id corresponds to name so try like this


Its a bug in apple’s uiautomation library. So you cannot use this.

1 Like