How to test that staticTexts contains a string using XCTest
You can use NSPredicate to filter elements. let searchText = “the content of the staticText” let predicate = NSPredicate(format: “label CONTAINS[c] %@”, searchText) let elementQuery = app.staticTexts.containing(predicate) if elementQuery.count > 0 { // the element exists } With CONTAINS[c] you specify that the search is case insensitive. Have a look at Apples Predicate Programming Guide