You may need to locate your Android app’s elements during mobile automation using Appium. There is a tool called Appium Inspector for iOS platform for this purpose. However, there is no such provision for Android platform. As a solution for this, you can use Android SDK’s UIAutomatorViewer tool to locate Android app elements. This tutorial shows how.
As an example here, we will try to locate an element of Calculator application in Android devices. We will locate an element with number 8 in Calculator app. Follow below steps to do this.
- Navigate to your Android SDK’s ‘tools’ directory.
- Invoke UIAutomatorViewer by double clicking uiautomatorviewer.bat file.
- Enable USB Debugging in your Android device and connect it with your system. You can also use emulator over here.
- Open Calculator application in your device.
- Take screenshot of Calculator app using small screenshot icon UIAutomatorViewer.
- Click number 8 in opened screen capture of Calculator app. You should see details of selected element in ‘Node Details’ section.
- You can use locators such as ID, Name, XPath etc. from Node Details section.
Hope the above tutorial to locate Android app elements using UIAutomatorViewer would be helpful to all of you. Would love to see your inputs regarding it in comments.
Comments
Post a Comment