How to write iOS Class Chain Strategy for Xpath axes?

Can you please help me how to write iOS Class Chain for the below Xpath ?

  1. //XCUIElementTypeStaticText[@name=‘Next’]/following::XCUIElementTypeStaticText[1]

  2. //XCUIElementTypeStaticText[contains(@value,‘What’)]/ancestor::XCUIElementTypeTextView[1]

I’m afraid this is not possible. Class chain locators don’t support axes

Thank you! Please let me know any other alternative methods to achieve above xpath conditions. Xpath is very slow for IOS Appium Test execution.

For the second one I would try something like

**/XCUIElementTypeTextView[$type == 'XCUIElementTypeStaticText' AND value CONTAINS 'What'$]

The first one is more tricky. Most likely it will be necessary to perform several class chain queries, although I’m not quite sure these all are going to be much faster than the single given xpath

What is use of appending $ symbol ?

Thanks for sharing link !


What is class chain locator for below xpath :