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?
- Launch the desired app on a physical device.
- Connect your physical device to your development machine.
- 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?
- Connect your device to the PC using an USB cable .
- Launch the desired app
- Launch UI Automator(/SDK/tools/UI Automator)
- Click on green colored icon device icon takes a snapshot of your device.
- Move the cursor to desired object and Select the Object Properties.
- 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” com.flipkart.android:id/flyout_parent_title
Android App Attributes
- Id
- Name
- Linktext
- Partial Linktext
- Tag Name
- Class name
- Css
- xpath
Errors and their solution while Accessing UI Automator
- Error- “No Android devices were detected by adb”
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.
I can’t view elements of 3rd party native
apps which is basically a game built with unity
. What shall I do ?