Appium IOS Driver getText() for Element

I am trying to get the text of an UILAbel. I am using this command

WebElement uiElement = driver.findElementByAccessibilityId(element);
String text = uiElement.getText();

Here the getText() is returning the accessibility label of the element. I am interested in the actual text thats displayed by the UILAbel. How can I get it?

I am using the 3.4.1 version of appium Java client


first print in console your page source:


then you can see is text that is visible on client screen EXISTS in any element attribute.

if it is in “value” = you are lucky and you can get it with:


if you are not lucky you meet with Apple known issue and to resolve it you need to set value in client code yourself or ask developer (normally automation QA does it himself). look in code were label getting value and duplicate it to “accessibilityValue”:

label.text = valueString;
label.accessibilityValue = valueString;

rebuild client. and now you can see your text as Value attribute.