appium/appium — pull request #3730 by bootstraponline (2014-09-29 14:36:34+00:00)
Title: Fix UiSelector instance in find_elements

If a UiSelector already uses instance, then invoking instance again
will replace the original instance number. The UiSelector will then
point to a completely different element.

To fix this problem, these selectors ending with instance are detected
via a regex and the extra .instance call is avoided.

Fix https://github.com/appium/java-client/issues/100

---

I verified this solves the issue. I haven't done additional testing. It probably makes sense to add a unit test for this so find_elements doesn't regress in the future. If the feedback on this change is positive then I'll write a test before it's merged.