docs/index_paths.md in appium_lib-8.2.1 vs docs/index_paths.md in appium_lib-9.0.0
- old
+ new
@@ -6,17 +6,17 @@
> <UIAStaticText name="Alerts" label="Alerts" value="Alerts" dom="" enabled="true" valid="true" visible="true" hint="" path="/0/1/1/10/0" x="17.578125" y="596" width="53.90625" height="25.78125">
The index path can be used by calling [getElementByIndexPath]( https://github.com/appium/appium-uiauto/blob/af1befa8208074686cd38b845ddefabc057106fc/uiauto/lib/mechanic-ext/xpath-ext.js#L239):
```ruby
-# ruby example
+# ruby example # For Appium(automation name), not XCUITest
execute_script('$.getElementByIndexPath("/0/1/1/10/0")').text # Alerts
```
Internally what happens is `/0/1/1/10/0` is transformed into `1/1/10/0` and executed as follows:
```ruby
-# ruby example
+# ruby example # For Appium(automation name), not XCUITest
execute_script('$.mainApp().elements()[1].elements()[1].elements()[10].elements()[0]').text # Alerts
```
The initial 0 refers to the context so that's [discarded](https://github.com/appium/appium-uiauto/blob/af1befa8208074686cd38b845ddefabc057106fc/uiauto/lib/mechanic-ext/xpath-ext.js#L218).