Identify Elements Using Appium Inspector & Uiautomator


Steps to start Appium Inspector and inspect elements

  1. First of all, you need to start Appium GUI and then start a new session with appropriate desired capabilities for the AUT.
  2. A new window will open up, as shown in the above image.
  3. Now to locate the elements, do the following -
  4. Click on any element on the image on the left-hand side of the screen.
  5. After clicking, you will find the XML hierarchy of the app source displayed on the screen.
  6. On the right-hand side of the screen, you will find the attributes of the selected element like id or XPath of the element.
  7. You can now use your preferable method of finding the element, either by XPath or by id or by class.

 Identify Elements using uiautomator

What Is UIAutomator Viewer?
UiAutomator is a tool that comes with Android SDK (>= API 16) which is helpful to automate the UI. It’s a good GUI tool to scan and analyze the UI components of an Android application. For ease, it captures screenshot of our device where we can identify the elements. This works for only Android. As I’m focusing only on Automating Android Apps here. This UIAutomator would be a .bat file in windows OS and it would be a script file in Unix systems. This comes with Android SDK itself. This tool works only when you’re connected to a device (Maybe real/ emulator). UIAutomator Viewer does not support WebView.

First Step:

Launching UI Automator Viewer

Launch UIAutomatorviewer
For Windows operating system:

To launch UIAutomatorviewer, go to the path where you’ve installed SDK and find uiautomatorviewer.bat. Double click on it to launch.


Once it’s launched, then click on calculator app in your device. Now in UIAutomatorViewer tool, Click on Device Screenshot image button present in the toolbar. Now this will capture a screenshot of the app which was launched.


On the Right top. it displays calculator app’s UI element’s hierarchy view. And the bottom part will display the properties in detail of selected element. This is how you can inspect any element of android native app using UIAutomatorViewer tool. You just need to click on element and it displays element’s properties in detail. It’s good to save the screenshots captured by that tool for our use at later point of time.
adb commands
  • adb.exe start-server
  • adb.exe kill-server



Followers