我在尝试使用 Earl Grey 编写 UI 测试时遇到问题,特别是如何在某个 UITabBarItem 上执行点击。
我注意到标签栏项目不允许在 Storyboard 中设置辅助功能 ID 和标签,我尝试在运行时使用 barItem.accessibilityLabel = "label"
但当使用 EarlGrey.select(elementWithMatcher: grey_accessibilityLabel("label")).perform(grey_tap())
有没有办法做到这一点?
最佳答案
如回答here ,您可以使用此匹配器来查找标签栏元素。
匹配器示例
EarlGrey.selectElement(with: grey_text(tabbarTitle))
.inRoot(grey_kindOfClass(UITabBar.self))
.perform(grey_tap())
关于ios - 使用 EarlGrey 点击 UITabBarItem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44665953/