Is there any way to use "following sibling" command in xpath in android ? Appium is not able to recognise it!

I’m trying to find all the relative layout elements below a linear layout element.I used the below ommand in xpath.

//android.widget.ExpandableListView[1]/android.widget.LinearLayout[text() = ‘List of devices’]/following-sibling::android.widget.RelativeLayout

Appium is returning me " Failed to locate element "

Is this the correct syntax of using following sibling or is there any alternative way of finding those elements with any other locator strategy??

Best is to use android native selector, please refer to the doc.

@sebv : do you mean Appium node js doc link .ie. https://github.com/admc/wd/blob/master/doc/api.md ? btw We use NodeJs webdriver implementation

http://appium.io/slate/en/master/?ruby#adjusting-network-connection

should be like this:

  //android.widget.ExpandableListView[1]/android.widget.LinearLayout[@text = 'List of devices']/following-sibling::android.widget.RelativeLayout

or just:

//*[@text = 'List of devices']/following-sibling::android.widget.RelativeLayout

driver.findElementByXPath("//android.widget.TextView[@text='a1492']/../following-sibling::android.view.ViewGroup").click();

I tried above but did not work.

I tried above but did not work. Am I missing anything here?

Do we have any way to handle following-sibling for native android locator?