'Parents and siblings in query in XCTest (UI testing)
In other languages is possible to make such query:
class:B text:"text_I_looking_for" sibling class:C
or
class:B text:"text_I_looking_for" parent class:A child class:C
How to perform such query in XCTest? I need find element to 1. Check if it's present 2. Click it.
PS I know XCTest has simply syntax, but in some cases it's not enough solution. Maybe it's possible to use NSPredicate syntax?
Solution 1:[1]
.containingType was obsoleted in Swift 3. You can use .containing instead (I'm on Xcode 13):
XCUIApplication().otherElements.containing(.image, identifier: "circle").staticTexts["3"]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Alvin L |
