Ios 为什么NSPredicate的XUIApplication元素类型不同?
我不熟悉iOS XCUI自动化。我们正在使用Ios 为什么NSPredicate的XUIApplication元素类型不同?,ios,swift,ui-automation,xctest,Ios,Swift,Ui Automation,Xctest,我不熟悉iOS XCUI自动化。我们正在使用NSPredicate查找元素 let query = self.application .descendants(matching: XCUIElement.ElementType.any) .matching(matcher.getMatcher() as! NSPredicate) 当我们试图创建谓词时,元素类型是不同的 // Predicate to find an element using
NSPredicate
查找元素
let query = self.application
.descendants(matching: XCUIElement.ElementType.any)
.matching(matcher.getMatcher() as! NSPredicate)
当我们试图创建谓词时,元素类型是不同的
// Predicate to find an element using accessibility label
func getLabelMatcher() -> Any {
NSPredicate { (e, _) in (e as! XCUIElementAttributes).label == self.label }
}
// Predicate to find an element using accessibility id
func getIdMatcher() -> Any {
NSPredicate { (e, _) in (e as! XCUIElementAttributes).identifier == self.id }
}
// Predicate to check if element exists
func getDisplayedMatcher() -> Any {
NSPredicate { (e, _) in (e as! XCUIElement).exists }
}
为什么NSPredicate闭包对象(在本例中为e)有时是xguielementattributes
,xguielementsnapshot
和xguielement