iOS class chain locator finds all descendent elements if desired child element not there in parent


#1

Having code as below:

<XCUIElementTypeTable>
<XCUIElementTypeCell>
  <XCUIElementTypeStaticText name="US$ 4.00 ∙ 5-10 min">
  <XCUIElementTypeOther>
  <XCUIElementTypeStaticText name="QA- Hint Images (many images)">
  <XCUIElementTypeImage>
<XCUIElementTypeCell>
  <XCUIElementTypeStaticText name="US$ 5.00 ∙ 55-10 min">
  <XCUIElementTypeOther>
  <XCUIElementTypeStaticText name="Test name">
  <XCUIElementTypeImage>
<XCUIElementTypeCell>
<XCUIElementTypeCell>
<XCUIElementTypeCell>
<XCUIElementTypeCell>
<XCUIElementTypeCell>
<XCUIElementTypeCell>
<XCUIElementTypeCell>
<XCUIElementTypeCell>
<XCUIElementTypeCell>
<XCUIElementTypeCell>
<XCUIElementTypeCell>
<XCUIElementTypeCell>
<XCUIElementTypeCell>
<XCUIElementTypeCell>
<XCUIElementTypeTabBar>
<XCUIElementTypeWindow>
<XCUIElementTypeWindow>

Used below classchain: “_/XCUIElementTypeTable/XCUIElementTypeCell[1]/XCUIElementTypeStaticText[3]" If you see first TypeCell element, there are only 2 child elements of type “XCUIElementTypeStaticText”. So when i run "_/XCUIElementTypeTable/XCUIElementTypeCell[1]/XCUIElementTypeStaticText[3]” it should give no element because there are only two elements, instead it gives third element which is part of 2nd TypeCell element. And if i use “**/XCUIElementTypeTable/XCUIElementTypeCell[1]/XCUIElementTypeStaticText” then it gives all descendant “XCUIElementTypeStaticText” element.It should give only two elements as XCUIElementTypeCell[1] parent element have only 2 XCUIElementTypeStaticText

Found in appium 1.8 and latest version also(I verify this issue on deskop/ Appium inspector.


#2

this should be fixed in [email protected]


#3

Thanks for the update @mykola-mokhnach, it will be available in Appium version > 1.10.0 ?
Also, do we need to update Java-Client to latest (7.0.0), i am using 6.0?