如何在UITests Target中找到带有accessibilityIdentifier的UIView

Nik*_*nko 4 xcode ios xcode-ui-testing

我试图在测试目标中找到一个UIView带有navigationBar 的元素,accessibilityIdentifier以便检查isEnabled状态.

尝试了不同的解决方案,但找不到所需的解决方案.有没有办法实现想要的东西?

试过这个解决方案:application.groups.matching(identifier: "navigationBar")- 不起作用.

Ole*_*tha 10

可以使用查询常规视图otherElements.

let app = XCUIApplication()
app.otherElements["navigationBar"]
Run Code Online (Sandbox Code Playgroud)