Search code examples
androidandroid-studioappiumwebdriver-ioui-testing

Webdriverio, Android: How to write xpath properly using layout inspector?


I'm no familiar with android app developing and testing.

However, I find myself that I'm only using resource-id when I need to find elements. But some elements doesn't have resource-id. So my thoughts was to use XPath to find elements.

How xpath would looks like for element TextInputEditText if parent element have id: card_name_input?

layout inspector

Something like this?

//*[@resource-id="card_name_input"]//???

Solution

  • Layout Inspector in Android Studio is not showing actual classes and widgets, so can't be used for building xpath.

    uiautomatorviewer and monitor provided with Java SDK seems like deprecated, I had a difficulties with running them.

    Last thing is Appium ui inspector which show me correct xpath for element.