How to get the full xpath of android for to use this xpath to find the next text view.
Ex. Data on mobile screen A
1. AAAA 50%
2. BBBB 30%
3. CCCC 20%
Ex. Data on mobile screen B
1. AAAA 30%
2. BBBB 30%
3. CCCC 40%
xpath of AAAA ;
//hierarchy/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.view.ViewGroup[1]/android.view.ViewGroup[1]/android.view.ViewGroup[1]/android.view.ViewGroup[1]/android.view.ViewGroup[1]/android.widget.ScrollView[1]/android.view.ViewGroup[1]/android.view.ViewGroup[1]/android.view.ViewGroup[3]/android.view.ViewGroup[2]/android.view.ViewGroup[2]/android.widget.TextView[1]
xpath of 50% ;
//hierarchy/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.RelativeLayout[1]/android.view.ViewGroup[1]/android.view.ViewGroup[1]/android.view.ViewGroup[1]/android.view.ViewGroup[1]/android.view.ViewGroup[1]/android.widget.ScrollView[1]/android.view.ViewGroup[1]/android.view.ViewGroup[1]/android.view.ViewGroup[3]/android.view.ViewGroup[2]/android.view.ViewGroup[3]/android.widget.TextView[1]
I thing solution to this way
def k1 = xpath of AAAA
def k2 = k1.substring(0,482)
def k3 = (k1.substring(482,483) as int)+1
def p1 = k2+k3+‘]/android.widget.TextView[1]’
But I can’t to the hard code the full xpath. Because of data on screen is dynamic and i can’t get the full xpath for the used sub string function.
Currently I find xpath’s AAA by text
def getXpathDefind(String texts){
TestObject myObject = findTestObject(‘Object Repository/Text’,[(‘text1’): texts])
return myObject
}