Search code examples
appium

How to take xpath for spinners which has same id & class in mobile automation(Appium)


image description here

Since Parent Location2, Parent Location1, Location & Channel spinner has same id & class , how to get the xpath for the ParentLocation2?


Solution

  • You can give a try to xpath with indexes and nodes, below are different examples for same:

    By.xpath("//android.widget.RelativeLayout[@index='8']")
    
    //android.widget.RelativeLayout[8]