Posted on

FREE courses –
Step 1 : Connect mobile device to computer system
through cable OR through wifi

Step 2 : Run command adb devices

Step 3 : Start UIAutomatorViewer
Windows – goto android-sdk/tools/bin
Mac – from terminal run command uiautomatorviewer

Step 4 : Open the application on mobile device and capture on uiautomatorviewer to find element locators


FREE Courses –
Udemy –
Training by Raghav at your venue –
Training schedule –
———— UI TESTING ————
Selenium Beginners –
Selenium Java Framework from Scratch –
Selenium Python –
Selenium Tips –
Selenium Builder –
Katalon Studio –
Robot Framework with RIDE-
Robot Framework with Eclipse –

———— API TESTING ————
Web Services (API) –
SoapUI –
Postman –
General –
Katalon Studio API Testing –

Appium –
Mobile Playlist –

———— CI | CD | DEVOPS ————
Jenkins Beginner –
Jenkins Tips & Trick –
Docker –

Git & GitHub –

JMeter Beginner –
JMeter Intermediate –
JMeter Advanced –
JMeter Tips & Tricks –
Performance Testing –

Java Beginners –
Java Tips & Tricks –

———— IDE ————
Visual Studio Code –

———— MAVEN ————
Maven –

———— OTHERS ————
Misc –
Tools & Tips –
QnA Friday-
Sunday Special –

Ask Raghav –
Interviews –
All Playlists –

Keep Learning,

Website –
LifeCharger –
Udemy Courses –
Facebook –
Twitter –
Youtube –
Instagram –

You can support my mission for education by sharing this knowledge and helping as many people as you can.


Xem thêm bài viết khác:

27 Replies to “Appium Beginner Tutorial 9 | How to use UIAutomatorViewer for Object Locators”

  1. Raghav, I have downloaded the command line tools zip file. After unzipping I didn't find the uiautomatorviewer.bat file, Kindly help.

  2. Hi Raghav, how to handle the element or know the object/elements involved if the app was using a WebView or using a Hybrid? .

  3. Hi Raghav, where can I find this UI Automator Viewer? I downloaded the command line tool for Windows and installed it properly. But I cannot find the UI Automator Viewer tool in the folder

  4. Hi Raghav,

    I am using macOS for iOS mobile development.
    I can't open the UIAutomatorViewer. I am using the simulator of Xcode and I can't use the 'uiautomatorviewer' on my terminal.
    It only display: -bash: uiautomatorviewer: command not found

    Can you help me out? Thanks.

  5. Hello
    When I run "uiautomatorviewer.bat" through terminal then its shows error like
    "-Djava.ext.dirs=..libx86;..lib is not supported. Use -classpath instead.
    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit. "
    OS :- Windows 10
    Can you please give me any suggestion?

  6. Hi Raghav,

    I am not able to inspect an element for the respective page in android application getting an error message as:
    Error while obtaining UI hierarchy XML file: Remote object doesn't exist!
    Please help me out

  7. I just get "Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema" when I try to run SDKmanager.bat and error "-Djava.ext.dirs=..libx86_64;..lib is not supported. Use -classpath instead.
    Error: Could not create the Java Virtual Machine.
    Error: A fatal exception has occurred. Program will exit." when I try to run UIAutomatorViewer.bat in cmd. JAVA_HOME is pointing at "C:Program FilesJavajdk-13.0.1"

  8. Hi Raghav sir,
    i am not able to click on login button application show error message
    Element info: {Using=id, value=com.pixilapps.selfcare:id/btn_skip}
    null please help me

  9. Hi Raghav,
    I am getting an error in UI automator viewer saying "unable to connect to adb" in cmd prompt I can see that my device is attached..
    Please help

  10. Sir. I'm trying to automate an app. One of the option in app when I inspected in the UI automator it is showing as clickable =false. Cos of which my script is not clicking the option. Can you suggest me how to resolve it or how to click on that option.

  11. sir.. if im trying to uiautomator and try to click on device screenshot option im getting this below error. please tell me what is the solution for this.
    "Error while obtaining UI hierarchy XML file: Remote object doesn't exist!]"

  12. Please tell how do I start UIautomatorviewer in linux….I can't run that file ( I have also run chmod command )

  13. Hi Raghav, I am getting below error message pop-up while taking the screenshot using uiautomatorviewer.
    "Error while obtaining UI hierarchy XML file: Remote object doesn't exist!

    I have check my device is connect: using adb devices.

  14. hello Raghav
    i get this error
    Exception in thread "main" java.lang.UnsatisfiedLinkError: Cannot load 32-bit SWT libraries on 64-bit JVM

    at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)

    at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)

    at org.eclipse.swt.internal.C.<clinit>(Unknown Source)

    at org.eclipse.swt.widgets.Widget.<clinit>(Unknown Source)

    at org.eclipse.jface.window.Window.createShell(

    at org.eclipse.jface.window.Window.create(



    solution please

  15. Error obtaining UI hierarchy
    Reason: unexpected error while obtaining UI hierarchy.
    Logs in cmd:- E/Screenshot: unsupported protocol: 2

    Can anyone help in this? I did it for 7-8 times and every time i am facing the same issue. Appium server is running and i can see the devices in list as well(in cmd via adb devices).
    My android version is 8.1.0

  16. Hi Raghav,
    That was an interesting session. Can we you UI Automator to locate elements from Webpage by connecting our real device?

  17. Error while obtaining UI hierarchy. This is what i have been esperiencing for the past 2 weeks. I have used all the solutions online, add the Uiautomator path to the file or copying the adb.exe file into uiautomatorviewer.bat. I don't know what to do anymore.

  18. Watched a lot of your videos and now came back to comment here.
    Your videos are the best. I am glad I found your channel.

  19. Hi Raghav,
    I am getting below error while taking the "Device screenshot"

    Error obtaining UI hierarchy

    Error taking device screenshot: EOF
    Could you please help me on this?

Leave a Reply

Your email address will not be published. Required fields are marked *