How to form a predicate from xpath locator


I want to know about how will you write a predicate formation of the locator from XPath without index. Because it has more hierarchy to point the element. I tried from the forums which have been posted about the predicate-locator /class chain locator formation. But, I couldn’t form it.

XPath- //XCUIElementTypeOther/XCUIElementTypeOther[@label=‘Subject Gallery’]/…/…/…/…//XCUIElementTypeOther[@name=‘swipe_opt_more_container’ and @visible=‘true’] - Is there any other way of formation with xpath itself to change it? or with the predicate how can I change this multiple hierarchy ?

Thanks in advance.

iOSClassChain = "**/XCUIElementTypeOther[`label == \"Subject Gallery\"`]/**/XCUIElementTypeOther[`name == \"swipe_opt_more_container\" AND visible == \"true\"`]")

Thank you will try out this. @Aleksei:slightly_smiling_face:

Did that work Mirudhu?

i have something like this: **/XCUIElementTypeOther[label == " Search for a store, area or region"][2]