How to use 'index' node detail to find element in android native app

Object inspector used - uiautomatorviewer

How to use ‘index’ node detail to find element in android native app using appium java client?

Is that you need to find element using index. If so you can use xPath

Thanks Antony…

I used xpath and inserted the index in it and I was able to use it

eg WebElement e1=seleniumFunctions.getElement(driver, By.xpath("//android.widget.RelativeLayout[@index=‘8’]"));


Can you please help me to identify what is wrong with the following xpath:

i dont get any error but, it does not work as well


try -




1 Like

Does anyone know if i can use more than one Webelement property to find an element?

eg I want to use index and resource id of a webelement instead of just resource id.

thanks i’l try it …

and i have not used index and resource id together but i have attempted something like this:
“driver.findElement(“TextView”));” and it worked for me. (if this helps)

i had already tried “driver.findElementByXPath(”//android.widget.RelativeLayout[2]/android.widget.RelativeLayout[1]/android.widget.TextView[2]")" but it did not work, and in my case i couldn’t have used “driver.findElementByXPath(”//android.widget.TextView[@index=‘2’])" due the way it is designed.

But, i did it some other way!

instead of this you can use


It will surly locate element

@pavant @Antony_Barnabas @rashiatry @neharm27 @willosser Iam using the below code to select the first three check box …but when first it check the first checkbox,then while selecting the second checkbox ,it automatically uncheck the first check box,pls solve this issue…how to select the multiple check box at a time


@suryasurendar, you state that the first check box becomes unchecked when selecting the second box. Is the second box getting checked? If not, then something is incorrect in your xpath. Please forgive me for asking this next questions – are the box selections mutually exclusive?

Yes, it is selecting the second box,no its not mutually exclusive

I’m at a loss to guess. I think I would break out the code so that the click action is separate from the call to findElement(). Verify the call to click() is causing both clicks to occur. Also, in order to assist, what version of Appium are you using? And what version of AppiumLib?