I think this is the bug in Appium.
Please go through below my research and correct me if I am wrong.
Please see the way Appium is translating this Xpath query before sending it to IOSUiaAutomation:
au.getElementsByIndexPaths(["/\0/0/2/1/0/1/0"])\
If we specify any index in Xpath Query then translated Index path will not contain a list of Index paths.
If I write my Xpath query as ://UIATableView/UIATableCell/UIATextView
then this will be translated as
“au.getElementsByIndexPaths([\”/0/0/2/1/0/1/0\",\"/0/0/2/1/0/2/0\",\"/0/0/2/1/0/3/0\"])"
}
so it seems that when we dont specify any index in xpath, then translated Index path contains list of Index paths which makes Appium to return elements at specified index from all parents.
but list of Index paths should be generated eventhough my xpath query contains index at the end (e.g.//UIATableView/TableCell/UIATextView[1]) to be able to get all UITextView elements which are first child of all TableCell elements.
Please help in resolving this.
Thanks and Regards,
Pranoday