iOS isDisplayed() returns false when element is visible

I am automating an iOS app.
I have an element, let’s call it ‘valueElement’. I want to get its value attribute so I run:

Before getting the text I call wait.until(visibilityOf(valueElement)) to make sure it is visible before using it.
The waiting loop never ends and I cannot get the element’s value (because isDisplayed() always false).

  • The element is visible:true in appium inspector.

  • When executing driver.getPageSource() it shows the element as visible:true.
    Although that, isDisplayed() returns false.

  • When connecting to session during the execution, it shows visible:true when isDisplayed() returns false.

  • Another bizarre thing!
    I am running my tests using Jenkins CI. when I run the test locally on my computer it works perfectly. But, when I execute it on the VM it does not work. No changes were made on this specific element (valueElement) on the iOS mobile code.

  • My local computer is identical to the VM and still, it does not work on the VM.

  • appium: 2.0.0-beta.40

  • java-client: 7.6.0

  • Xcode: 13.4

  • MacOS: Monterey (M1 chip)

For now I worked around it, I wait for the valueElement’s parent visibility and then just running valueElement.getText() without the visibility check on the element.
Could it be a WebDriverAgent issue? Xcode internal? (it works on one computer and not the other one with the same setup)

Will provide more info if needed. Thanks.

I also found this: Appium iOS on Bitrise returns false when checking element displayed and he tells he had the exact issue (works locally but not on the CI, regarding iOS visibility).