What I found investigating this question is that the xpath is being reported by page source incorrectly for two reasons:
a) it’s zero-based
b) the very first AppiumAUT and UIAApplication elements are siblings, not parent/child, as reported by get_source:
I’m pretty sure it’s zero based because the code that uses the path indexes into an array. For example if we have one window with a path of “/0” then the code would access it via element_array[0]. If you want to convert the path string to use in xpath directly then yes, you’d need to add one as XPath itself starts at 1.
Ok, I certainly wouldn’t argue with you, being one of the appium authors, it just seems like it has pretty high potential to cause confusion, especially being named ‘path’ and not ‘indices’ or something else… just my .02
I agree it’s potentially confusing. The docs should probably be improved to explain the XML structure better. If you feel strongly about renaming the attribute then feel free to submit an enhancement request on GitHub and the appium devs will review.