我将NSmenu对象作为statusMenu,我将其辅助功能标识符设置为“ testMenu”
但是当我尝试在下面的UItests中访问它时
let app = XCUIApplication()
let menu = app.menus.matching(identifier: "testMenu")
let count = app.menus.count
print("menu count is \(count)")
print("menu count is \(menu.count)")
if menu.count > 0 {
XCTAssertTrue(true)
}
else {
XCTAssertTrue(false)
}
我看到以下错误
`
Replying to query <XCTElementQuery: 0x60c0000a6cc0> with results: (null) (error: Error Domain=com.apple.dt.xctest.automation-support.error Code=2 "No matches found for Find: Elements matching predicate '"testMenu" IN identifiers' from input {(
Menu, 0x608000183dc0,
Menu, 0x608000187c50,
Menu, 0x60800018c300,
Menu, 0x608000184440,
Menu, 0x608000188130
)}"`