Issue #628

extension XCUIElementQuery: Sequence {
    public typealias Iterator = AnyIterator<XCUIElement>
    public func makeIterator() -> Iterator {
        var index = UInt(0)
        return AnyIterator {
            guard index < self.count else { return nil }

            let element = self.element(boundBy: Int(index))
            index = index + 1
            return element
        }
    }
}

extension NSPredicate {
    static func label(contains string: String) -> NSPredicate {
        NSPredicate(format: "label CONTAINS %@", string)
    }
}

let books = app.collectionViews.cells.matching(
    NSPredicate.label(contains: "book")
)

for book in books {

}