Reputation: 21
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?
Upvotes: 0
Views: 1816
Reputation: 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"]
Upvotes: 0
Reputation: 21
Today I find out Xcode 7.3 is using this mechanism:
XCUIApplication().otherElements.containingType(.Image, identifier:"circle").staticTexts["3"]
This query will return staticText object with "3" as value. This object has 'otherElement' as a parent and 'Image' with id 'circle' as sibling.
Upvotes: 2