Inspect Android App Elements using UIAutomatorViewer

Inspect Android App Elements using UIAutomatorViewer


Inspect Android App Elements using UIAutomatorViewer

Before designing a test we have to find the elements on which we perform desired actions.To analyze the UI interface we will use uiautomatorviewer. UIAutomatorviewer shows a split screenshot of all the UI components in the Node Detail so you can see their different properties. From the properties you can find a desired element.

What is UIAutomatorViewer?

UI Automator viewer  is a GUI tool to scan and analyze the UI components of an Android application. It provides a convenient ways to identify android App UI components displayed on Android App.It is used to inspect the layout hierarchy and properties of Android UI components available on the device screen.

Where UIAutomatorViewer is located?

UIAutomatorViewer is located in the <android-sdk>/tools/ directory

Steps to launch UIAutomatorViewer?

  1. Launch the desired app on a physical device.
  2. Connect your physical device to your development machine.
  3. Open a terminal window and navigate to the <android-sdk>/tools/ directory or directly navigates to <android-sdk>/tools/ directory .

How to use UIAutomatorViewer to inspect elements of Android App?

  1. Connect your device to the PC using an USB cable .
  2. Launch the desired app
  3. Launch UI Automator(/SDK/tools/UI Automator)
  4. Click on green colored icon  device icon takes a snapshot of your device. 3
  5. Move the cursor to desired object and Select the Object Properties.2
  6. In the ” Node Details ” section we will find the desired object locators with their properties. Here in the below screenshot you will find the properties of selected object “Electronics”

Android App Attributes

  1. Id
  2. Name
  3. Linktext
  4. Partial Linktext
  5. Tag Name
  6. Class name
  7. Css
  8. xpath5

Errors and their solution while Accessing UI Automator

  1. Error- “No Android devices were detected by adb” Error 11

Ans. For this reconnect your device and then click on refresh.

Conclusion :-

Hope this explanation is enough for UI Automator viewer which helps us to identify element properties.



1 thought on “Inspect Android App Elements using UIAutomatorViewer

Leave a Reply

%d bloggers like this: