Testing if an element is visible with Xcode 7 UITest

MatterGoal picture MatterGoal · Oct 20, 2015 · Viewed 20.2k times · Source

I want to verify if an element is visible or not depending on its .hidden property but I don't find a valid way to do that using the new Xcode 7 UI test stuff.

I've tried with myelement.exists and myelement.hittable but they doesn't seems to work as I expected. I suppose they work on conjunction with the hidden property. An hidden element shouldn't exists and is not hittable... but this is not the current behaviour (I can understand the exists behaviour... but a hidden element should be not hittable IMO).

Is there another way to verify the "hidden" property value?

Answer

Joe Masilotti picture Joe Masilotti · Oct 21, 2015

As of Xcode 7.1 Beta 3, UI Testing does not currently support validating the visibility of an element. I suggest filing a radar to bring the necessary attention to Apple.

Xcode 7.1 has fixed this issue. hittable now checks to see if the element is correct.