How to determine the XPATH of Android UI elements.

2019-06-23 23:28发布

I am currently working on automating an android application using Appium and Selenium and have run into some problems with locating elements by ID. I want to use XPATH but do not know how to get the XPATH of android UI elements. Does anyone know how to determine the XPATH of an element or know of a tool that can do this work quickly? Thanks!

8条回答
在下西门庆
2楼-- · 2019-06-24 00:10

You can use UIAutomatorviewer utility in Android SDK to get the required locator. Go to your Android SDK installation's 'tools' folder and trigger uiautomatorviewer.bat file. From there, you can locate app elements.

Visit this link which shows how to use it.

http://www.testingdiaries.com/locate-android-app-elements/

查看更多
Deceive 欺骗
3楼-- · 2019-06-24 00:16

Try viewing the source code:

https://android.stackexchange.com/questions/5039/how-do-i-view-source-in-the-android-browser

Then figuring out the xpath becomes easier from there.

查看更多
登录 后发表回答