appium / appium-for-mac

[deprecated] Application for automating a mac app with JSON wire protocol
Apache License 2.0
194 stars 70 forks source link

xpath is 1-indexed whereas axpath is 0-indexed #22

Open jlipps opened 7 years ago

jlipps commented 7 years ago

Might this be a source of confusion?

stuartbrussell-intuit commented 7 years ago

Hmmm, yeah that's one we should resolve somehow. The good news is that AfM assembles and dis-assembles AXPaths one step at a time, so it should be straightforward to record and playback as 1-indexed. The bad news is that macOS Accessibility APIs are in fact 0-indexed, so Accessibility Inspector (and others, e.g. UIElement Inspector from PfiddleSoft) displays elements as 0-indexed, which would be confusing if someone tried to verify a recorded path using those apps.

Maybe we could have a preference for AfM to use 1 or 0-indexing. This deserves some thought. Maybe we say XPaths wins because they shipped before AXPaths. Come to think of it, macOS accessibility API's actually shipped first, but not in the context of Selenium/WebDriver automation.