Unable to Access element if its accessibility properties are changed once and then rollbacked to previous settings

@jlipps @bootstraponline @jonahss @sebv @Hassan_Radi @Telmo_Cardoso @DanSmithSC

  1. I was accessing a UIALabel in iOS native App using XPath locator found using Appium Inspector previously.
  2. Then I changed its accessibility properties of Accessibility Identifier and Accessibility Value. I was able to access element using its identifier but unable to get the value in my automation code. [Reference of :
    https://github.com/appium/appium/issues/537]
  3. Now I Rollbacked changes of accessibility that I made in terms of Properties and Values.
  4. Now I am unable to access same UIALabel with same XPath and same label is NOT Available in Appium Inspector hierarchy too.

I am using Appium Version 1.4.13 (Draco) on MAC Yosemite Version: 10.10.5 (14F1021).

Thanks in Advance.

Hey there:
Something seems off here.
If your app had been working fine before your changes, then you made changes, then you reverted them - the app should be identical and behave in the same exact manner.

I’ll bet there’s something still off in your app under test. If you want to still rule out the appium inspector/tool chain you can use a tool called reveal. I posted about this here

Good luck!

@shermaneric

Thanks for your answer, But my situation is

  1. I made the same changes of assigning the the accessibility identifier and accessibility value to the elements but after this change when i am calling getText() method instead of getting displayed value I am getting its accessibility identifier this is UIAutomation Bug https://github.com/appium/appium/issues/537

  2. After This I was unable to get the text value of that element So I have rollbacked the changes of accessibility identifier and value but still I am unable to get the text value in that element So Please Suggest Some way to get the text from that element which is present in hierarchy but its text is not visible in inspector and my code too.( Note : developers have made changes to font of AUT)

Thanks in Advance.

Hi Salmanchauhan:
I see what you are saying now. UI Automation does not return a UIAStaticText’s value in the heirarchy, at least from the examples in that ticket.

Finding:
It’s interesting. I found a counterpoint to this case with Appium’s own Test Calculator App (I may not be reading this right).

  1. I check out the appium sample code repo, specifically. https://github.com/appium/sample-code/tree/master/sample-code/examples/ruby/arc_ios_calc
  2. I navigate locally to the above directory.
  3. Start Appium, then start arc.
  4. As the calculator program opens, I add 5 + 4 and see the Answer of 9.
  5. I launch the Appium inspector and inspect this.

Finding: I indeed see a value of 9 in that UIATextfield.
Note:

  • I navigated to the source code of this test app project (see below), and found variable answerLabel to be what drives the answer of the calculator app.
  • I’m not sure why it’s working here. From what I can tell, answerLabel initially set an accessibilityIdentifier of Answer.
  • Then, during computeAction answerLabel gets set as an AccessibilityLabel with the sum of 9.

https://github.com/appium/sample-code/blob/master/sample-code/apps/TestApp/Test%20App%202/MyViewControllerViewController.m

Final Note: If the above doesn’t work for you, the only other idea I have is setting an NSLocalizedString for your field and putting in the text you want there. I think this would only work for static text (as in - a dynamic answer to a calculator app wouldn’t work here). The stackoverflow link referenced in your github as you page down had one such example.

Hope this helps!

1 Like

Thanks eric. A really nice work around worked for me.

1 Like

@salmanchauhan,
Can you please let me know what is the alternative you worked on.
Am also facing the same issue, am getting the Accessibility labels rather than the label text.

Thank you