The problem that I see with the above code is that you are specifically trying to find a representation in the children of the application, not the descendants of the application. Children are strictly subordinate to the submission, and the search will not consider sub-sub-representations, etc. Other than that, it looks normal.
Try:
XCUIElement *pvc = [[app descendantsMatchingType:XCUIElementTypeAny] elementMatchingPredicate:[NSPredicate predicateWithFormat:@"accessibilityLabel == 'Places View'"]];
In addition, the default value for UIView is to not participate in accessibility at all, so in addition to setting the label (and by the way, the code snippet in your question about setting the label performs a comparison instead of an assignment), you should also make sure that you have enabled accessibility:
view.isAccessibilityElement = YES view.accessibilityLabel = @"AccessibilityLabel"
source share