Unable to read invisible label

Hi

I am trying to read an invisible label [providerId] but i have no luck yet.
Appium inspector didn’t show the invisible label.

Any suggestions ,please?

Below is the object property.

name: Babycareproviderufrdp B., FEATURED, Waltham, MA:, 5 mi, | 29 yrs old, 4 yrs experience, | $10-$20/hr, (1), (100)
type: UIAStaticText
value:
label: Babycareproviderufrdp B., FEATURED, Waltham, MA:, 5 mi, | 29 yrs old, 4 yrs experience, | $10-$20/hr, (1), (100)
enabled: true
visible: false
valid: true
location: {0, 108}
size: {320, 90}
xpath: //UIAApplication[1]/UIAWindow[1]/UIATableView[1]/UIATableCell[1]/UIAStaticText[1]
Code Snippet:-

[self.providerIdLabel setAccessibilityLabel:nil];

[self.providerIdLabel setAccessibilityLabel:[NSString stringWithFormat:@“providerId-%lld”, [providerObject.providerId longLongValue]]];

thanks
Charles

1 Like

@charles_brandeis
If you are on Android, try to inspect that element using UI Automator Viewer and get the element’s ID, try to locate the element in your test by ID and see how it works as you may have formulated a wrong xpath or it might be an Appium bug with the xpath locator itself.

@Hassan_Radi

Sorry,this issue is on iOS app

Charles

fyi - Developer inserted an invisible label as a helper text just to help test automation.

Charles

@charles_brandeis
Have you tried to locate the element using relative xpath instead of the absolute xpath you are using?? What is the Appium log when you try to read the text from it?? does it fail and say “Element not found”??

Is there a way to make the label visible using javascript executor?

This is my code when the label (providerId) is visible.
List providersList = driver.findElements(By.id(“providerId”));

    for(WebElement providerId : providersList) {
        System.out.println("provider id: " + providerId.getAttribute("name"));
    }

output:
provider id: Sitter O., FEATURED, Waltham, MA:, < 1 mi, | 35 yrs old, 3 yrs experience, | $15-$50/hr, (100), (100), providerId-1334
provider id: Babyprvdrhagos B., FEATURED, Waltham, MA:, 2 mi, | 29 yrs old, 4 yrs experience, | $10-$20/hr, (100), (100), providerId-18126
provider id: Sitter S., FEATURED, Waltham, MA:, < 1 mi, | 31 yrs old, 4 yrs experience, | $10-$15/hr, (1), (100), providerId-56004