title: How can I test for the existence of a UIView using XCUIElementsQuery?
body: <p>It is difficult to find proper documentation for the UI Testing Framework from Apple. I've seen many examples where it is possible to find buttons and labels with specific names, but how can I look for generic UIViews?</p>
  
  <p>For example, suppose I set a view with accessibilityLabel == "Some View", how can I find a view with that name during the test execution?</p>
  
  <p>I tried (unsuccessfully) the following code:</p>
  
  <pre><code>XCUIElement *pvc = [[app childrenMatchingType:XCUIElementTypeAny] elementMatchingPredicate:[NSPredicate predicateWithFormat:@"accessibilityLabel == 'Places View'"]];
  
  NSPredicate *exists = [NSPredicate predicateWithFormat:@"exists == true"];
  [self expectationForPredicate:exists evaluatedWithObject:pvc handler:nil];
  [self waitForExpectationsWithTimeout:10 handler:nil];
  
  NSLog(@"%@", [[app childrenMatchingType:XCUIElementTypeAny] elementMatchingPredicate:[NSPredicate predicateWithFormat:@"accessibilityLabel == 'Places View Controller'"]]);
  </code></pre>