There is viewController with some HITTABLE text "exampleText". When you tap it a modal opens with the same "exampleText"(or even 2 cells with the same staticTexts "exampleText") My intent is to count those "exampleTexts" via countHittableElements
But the problem is that my method does elements search on modal as well as on viewController(which is under that modal) So if a have 2 "exampleTexts" on modal and try to use countHittableElements(name: "exampleTexts"), I always get an extra 1 element and my count fails.
func countHittableElements(name: String) -> Int {
return filterHittableElements(name: name).count
}
func getElements(name: String) -> XCUIElementQuery {
let predicate = NSPredicate(format: "label CONTAINS[c] %@", name)
return application.cells.staticTexts.containing(predicate)
}
func filterHittableElements(name: String) -> [XCUIElement] {
let all = getElements(name: name).allElementsBoundByAccessibilityElement
let onlyfilt = all.filter { $0.isHittable }
return onlyfilt
}
Is there a way to somehow ignore viewController content when a modal is opened above it?