问题
I'm writing UI test cases for my view controller.it has three views
1.A header view ->Stackview -> 4 buttons
2.table View
3.footer view - > 5 buttons
All views are accessible except stackview and its child buttons
Can anyone guide me how do i get reference of stackview and its child elements?
回答1:
Set the header view and stack view to be inaccessible and the child elements to be accessible. You can do this using the UIAccessibility API, setting isAccessibilityElement
to false for the containers. On the views you want to interact with, set isAccessibilityElement
to true and also set accessibilityIdentifier
on each view.
If a container view is accessible, its child views are often obscured to avoid confusion about what the user is trying to interact with.
来源:https://stackoverflow.com/questions/44899898/cannot-find-stackview-in-accessibility-indicator-in-xcuitest