I tried to use appium inspector to get elements in my app. When I move the mouse to one button to get its element definition, all the screen were chosen, I can’t get the element for the button.
Hi, it is a known problem…
it depends on your app. basically, iOS apps does not expose all its content to any application… but, it does expose its accessibility content (accessibilityIdentifier, accessibilityLabel…)
in order for you to see them using appium, you need the views to be defined as accessible (in the iOS mobile code) then, your app will expose them to appium.
ask yours developers to check how to make your iOS views accessible.
note that there might be a difference between iOS native, custom and third party views…
Note:
In order to make a view accessible you need to set its isAccessibilityElement to true and for its container view(and ancestors) to set isAccessibilityElement to false.
If the container view’s isAccessibilityElement is true, it will expose the container view as a whole and will hide its subviews(even if theirs isAccessibilityElement property is set to true).
By default, isAccessibilityElement is true for UIKit control(such as UIButton).