Any fast locator instead of XPath with not-direct search criteria

Appium: 1.7.1
Platform: IOS
Language: Java

Hi,

We are using annotation locator expressions, where we can’t transfer some XPath locators to a faster method.
The elements’ structural form is following:

Parent [A] : XCUIElementTypeCell
[A] has child [B] : XCUIElementTypeStaticText
[A] has child [C] : XCUIElementTypeButton

Please note, the [B] and [C] are on the same level in a hierarchy, they both are under the [A].

We need to reach to the child element [C], but the [C] can be found by [B], so we are searching [A] which contains [B] to get the [C].

The locator expression looks like this:

@iOSXCUITFindBy(xpath = “//XCUIElementTypeCell[./XCUIElementTypeStaticText[contains(@name,‘B’)]]/XCUIElementTypeButton[contains(@name,‘C’)]”)

Could you please help to convert that XPath slow and not recommended method to some other faster locator method so to replaced it in annotation expression.

Thanks

I think the answer is here - https://github.com/facebook/WebDriverAgent/wiki/Class-Chain-Queries-Construction-Rules

The method which allows replacing of the mentioned XPath is the Class Chain query. But seems there is a problem with it mentioned here Class chain query error on dollar sign