Appium Beginner Tutorial 9 | How to use UIAutomatorViewer for Object Locators

Sdílet
Vložit
  • čas přidán 21. 08. 2024
  • FREE courses - automationstep...
    IMP - In case you do not find uiautomatorviewer.bat, check this user comment:
    1. i had uiautomatorviewer.bat inside tools folder instead of tools/bin
    2. try getting sdk tools from androidsdkmana...
    3. can also use Appium Desktop Inspector instead of uiautomator
    4. In case appium server is running you can try after stopping appium and then open uiautomatorviewer
    4. uiautomatorviewer and sdkmanager.bat usually works well with java 8
    stackoverflow....
    5. For windows download the zip file from this link ,extract and continue it works. because the current file that we are downloading does not contain all files and folders required. try this.
    dl.google.com/...
    6. I'm getting 'unexpected error while obtaining ui hierarchy' when tried to take screen-shot using uiautomatorviewer on Mac - The issue got resolved by downgrading jdk from 1.8.261 to 1.8.231
    Step 1 : Connect mobile device to computer system
    through cable OR through wifi
    • Appium Step by Step fo...
    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
    #AppiumBeginnerTutorial
    FREE Courses - automationstep...
    Udemy - www.udemy.com/...
    Training by Raghav at your venue - raghav.qna@gmail.com
    Training schedule - automationstep...
    ----------- UI TESTING -----------
    Selenium Beginners - bit.ly/2MGRS8K
    Selenium Java Framework from Scratch - bit.ly/2N9xvR6
    Selenium Python - bit.ly/2oyMp5x
    Selenium Tips - bit.ly/2owxc50
    Selenium Builder - bit.ly/2MKNtlq
    Katalon Studio - bit.ly/2wARFdi
    Robot Framework with RIDE- bit.ly/2Px6Ue9
    Robot Framework with Eclipse - bit.ly/2N8DZxb
    ----------- API TESTING -----------
    Web Services (API) - bit.ly/2MGafL7
    SoapUI - bit.ly/2MGahmd
    Postman - bit.ly/2wz8LrW
    General - bit.ly/2PYdwmV
    Katalon Studio API Testing - bit.ly/2BwuCTN
    ----------- MOBILE TESTING -----------
    Appium - bit.ly/2ZHFSGX
    Mobile Playlist - bit.ly/2PxpeUv
    ----------- CI | CD | DEVOPS -----------
    Jenkins Beginner - bit.ly/2MIn8EC
    Jenkins Tips & Trick - bit.ly/2LRt6xC
    Docker - bit.ly/2MInnzx
    ----------- VERSION CONTROL SYSTEM -----------
    Git & GitHub - bit.ly/2Q1pagY
    ----------- PERFORMANCE TESTING -----------
    JMeter Beginner - bit.ly/2oBbtIU
    JMeter Intermediate - bit.ly/2oziNVB
    JMeter Advanced - bit.ly/2Q22Y6a
    JMeter Tips & Tricks - bit.ly/2NOfWD2
    Performance Testing - bit.ly/2wEXbLS
    ----------- PROGRAMMING -----------
    Java Beginners - bit.ly/2PVUcXs
    Java Tips & Tricks - bit.ly/2CdcDnJ
    GROOVY - bit.ly/2FvWV5C
    ----------- IDE -----------
    Visual Studio Code - bit.ly/2V15yvt
    ----------- MAVEN -----------
    Maven - bit.ly/2NJdDRS
    ----------- OTHERS -----------
    Redis- bit.ly/2N9jyCG
    Misc - bit.ly/2Q2q5xQ
    Tools & Tips - bit.ly/2oBfwoR
    QnA Friday- bit.ly/2NgwGpw
    Sunday Special - bit.ly/2wB23BO
    Ask Raghav - bit.ly/2CoJGWf
    Interviews - bit.ly/2NIPPxk
    All Playlists - bit.ly/2LSiezA
    Never Stop Learning,
    Raghav
    Udemy Courses - www.udemy.com/...
    CZcams - / automationstepbystep
    You can support my mission for education by sharing this knowledge and helping as many people as you can

Komentáře • 329

  • @RaghavPal
    @RaghavPal  Před rokem +2

    **IMP**
    In case you do not find *uiautomatorviewer.bat*, check this user comment:
    1. i had uiautomatorviewer.bat inside tools folder instead of tools/bin
    2. try getting sdk tools from androidsdkmanager.azurewebsites.net/SDKTools
    3. can also use Appium Desktop Inspector instead of uiautomator
    4. In case appium server is running you can try after stopping appium and then open uiautomatorviewer
    4. uiautomatorviewer and sdkmanager.bat usually works well with java 8
    stackoverflow.com/questions/49506036/uiautomatorviewer-error-could-not-create-the-java-virtual-machine
    5. For windows download the zip file from this link ,extract and continue it works. because the current file that we are downloading does not contain all files and folders required. try this.
    dl.google.com/android/repository/sdk-tools-windows-3859397.zip
    6. I'm getting 'unexpected error while obtaining ui hierarchy' when tried to take screen-shot using uiautomatorviewer on Mac - The issue got resolved by downgrading jdk from 1.8.261 to 1.8.231

    • @mangkanor4017
      @mangkanor4017 Před rokem

      Sir if there's no resources ID appearing, what should I do next for me to interact with that element using my code?

    • @RaghavPal
      @RaghavPal  Před rokem

      Can use other locators or check with some diff app

    • @pavankumar-xb7nw
      @pavankumar-xb7nw Před 2 měsíci

      @raghavpal I hv downloaded latest Android studio jellyfish. Not able to find uiautomator file and tools folder itself Kindly pls help me.

  • @nguyendoan6399
    @nguyendoan6399 Před 5 lety +6

    Your tutorial series are very helpful for beginners. Thanks so much. Hope you keep your passion.

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Thanks a lot for the wishes Nguyen

  • @testinginsights-muktasharma

    Hi Raghav, the way you are zooming on some important areas while showing the process,it’s great. Very helpful. Will it be possible for you to create one video on Appium interview questions and answers please? It will be great help.
    Thank you for your hardwork and all the efforts for the video!

    • @RaghavPal
      @RaghavPal  Před 3 lety +1

      Yes, definitely I will do Mukta

  • @EliasHossein799
    @EliasHossein799 Před 4 lety +3

    Just amazing as always...
    May Allah give you best reward.
    Thanks a lot for you for your kind helps...
    Allah has created some people to make the people's life easy and you are definitely one of them.
    You are the super talented, you know how to make the things easy..

  • @lkarthik1985
    @lkarthik1985 Před 5 lety +2

    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.

  • @andresfukazawa
    @andresfukazawa Před rokem

    Wow, another great video, thank you! You're like a human encyclopedia. 😄

  • @VikasKumar-gg2db
    @VikasKumar-gg2db Před 5 lety +4

    Please try to remove the background noise. It's really annoying otherwise the tutorial is really good. :)

    • @RaghavPal
      @RaghavPal  Před 5 lety +1

      Hi Vikas, I noticed it comes for 10 sec at around 3:20. Not sure how was it introduced.Will improve on the audio.

    • @brianrodgers4636
      @brianrodgers4636 Před 2 lety

      @@RaghavPal Were you getting a phone call?

  • @hayaulislam
    @hayaulislam Před 4 lety

    UI automator viewer shows blank screen of my android. What can be the problem?

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi, may be the sdk is not compatible. Check stackoverflow.com/questions/35124197/uiautomator-viewer-of-android-sdk-returns-blank-screenshot

  • @nehalahoti5749
    @nehalahoti5749 Před 3 lety

    And all your tutorial are very helpful and I learned a lot from each n every tutorial...Very easy to understand

  • @mv8167
    @mv8167 Před rokem

    Thank you for having so many exciting videos.

  • @f-22r
    @f-22r Před 4 lety +1

    I get: "C:\Windows\system32>uiautomatorviewer
    -Djava.ext.dirs=..\lib\x86_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."
    I researched the problem and you have to edit .bash_profile and that seems tough, so I will just use the Appium selector option.

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi, What is your java ver.
      You can check on cmd with command
      java -version.
      uiautomatorviewer and sdkmanager.bat usually works well with java 8
      Or you can try getting sdk tools from
      androidsdkmanager.azurewebsites.net/SDKTools
      Also check this
      stackoverflow.com/questions/46402772/failed-to-install-android-sdk-java-lang-noclassdeffounderror-javax-xml-bind-a
      stackoverflow.com/questions/49506036/uiautomatorviewer-error-could-not-create-the-java-virtual-machine

  • @user-zf1kk4sw7o
    @user-zf1kk4sw7o Před 9 měsíci

    Excellent learning

  • @rajateshr6106
    @rajateshr6106 Před 4 lety

    Hello Raghav,
    Your sessions are really usefull. Is it mandatory to install andriod SDK?

    • @RaghavPal
      @RaghavPal  Před 4 lety +1

      Yes, we need Android SDK with appium

  • @f-22r
    @f-22r Před 4 lety +2

    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=..\lib\x86_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 Files\Java\jdk-13.0.1"

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi, What is your java ver. You can check on cmd with command
      java -version.
      uiautomatorviewer and sdkmanager.bat usually works well with java 8
      stackoverflow.com/questions/46402772/failed-to-install-android-sdk-java-lang-noclassdeffounderror-javax-xml-bind-a
      stackoverflow.com/questions/49506036/uiautomatorviewer-error-could-not-create-the-java-virtual-machine

    • @f-22r
      @f-22r Před 4 lety

      @@RaghavPal Hi. It's 13.0.1 for jdk-13.0.1, and jre1.8.0_191, thanks. I should mention that I'm trying to get this to work with Android Studio instead of downloading files separately. I have installed API version I need for my phone. My phone is showing up correctly when I run "adb devices".

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Okay, can you try with java 8 as mentioned in the links and lets see if we get some diff output

  • @juliomerlo269
    @juliomerlo269 Před 3 lety

    Hello Raghav, I'm getting "Exception in thread "main" java.lang.NullPointerException"
    I am very grateful for your tutorials

    • @RaghavPal
      @RaghavPal  Před 3 lety +1

      Hi Julio, thanks, Pls check the detailed logs. Search for caused by section in logs. It will help in troubleshooting

  • @mdhossain529
    @mdhossain529 Před 3 lety +1

    Awesome sir

  • @PuligillaSanthosh
    @PuligillaSanthosh Před 3 lety +1

    Hi Raghav, do we need to install Android Studio, to get Uiautomaterviewer. Becuase, with sdkmanager cmdline-tools I couldn't see uiautomatorviewer in tools/bin?

    • @RaghavPal
      @RaghavPal  Před 3 lety

      You can, if you do not get it the other way

  • @vishnupavan9250
    @vishnupavan9250 Před 2 lety

    Hi Raghav, you mentioned that you thought how to connect a real android device through WIFI in 5&6th video. but you didn't thought how to connect through WIFI(could you please provide the link how to connect through WIFI) and you're classes are very very helpful, I owe for you

    • @RaghavPal
      @RaghavPal  Před 2 lety

      Hi Vishnu, Pls check czcams.com/play/PLhW3qG5bs-L8npSSZD6aWdYFQ96OEduhk.html

  • @jishavikram9536
    @jishavikram9536 Před 4 lety +2

    Hi Raghav,
    Thanks for the detailed session.
    Im facing an issue here. When I open the uiautomatorviewer and try to take the screenshot dump, I'm seeing an error popup.
    "Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!".
    I went through stackoverflow and other forums and tried few steps mentioned, but did not resolve the issue. I'm always seeing this. Could you please help.
    Note: I'm connected to a real device, Appium server is not running.

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Jisha, Is this for a specific application, did you try with a diff app or device

    • @jishavikram9536
      @jishavikram9536 Před 4 lety

      @@RaghavPal Hi Raghav, Not for specific app. I tried for a simple calculator app on my phone.

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Can try with a diff app

    • @adventurousmale
      @adventurousmale Před 4 lety

      @@RaghavPal I'm having the same issue across any app. I noticed the SDK tools folder is different now from Android Studios - could that be the issue?

    • @esumitkumar
      @esumitkumar Před 4 lety

      Hi Jisha..I was facing same issue ..Rebooting phone worked for me :)

  • @fabiochaconcampos221
    @fabiochaconcampos221 Před 3 lety

    Grande papa

  • @ricchan07
    @ricchan07 Před 4 lety +1

    This tutorial helped me a lot but I have one question. Whenever I click the uiautimatorviewer, the cmd just open for a while then close on its own. I also tried the other method which is typing cmd on the folder address but I keep getting this error: Cannot load 64 bit SWT libraries on 32-bit JVM. By the way, I'm using eclipse on mobile automation. Thanks in advance!

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi, what is your java ver. Some users found it works well with Java 8

    • @Modestov1998
      @Modestov1998 Před 2 lety

      Now I face the same problem! I am using Java 11:(

  • @andreotako2020
    @andreotako2020 Před 3 lety +1

    Raghav how could i scroll usin appium i tried
    ITouchAction t = (ITouchAction)new TouchActions(Driver);
    and the error:
    The IWebDriver object must implement or wrap a driver that implements IHasTouchScreen

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi Andre, driver should be passed as IPerformsTouchActions stackoverflow.com/questions/30909818/the-iwebdriver-object-must-implement-or-wrap-a-driver-that-implements-ihastouchs
      stackoverflow.com/questions/46550497/how-to-scroll-down-to-click-the-element-in-android-using-appium-and-java

    • @andreotako2020
      @andreotako2020 Před 3 lety

      @@RaghavPal wasn't work for me
      I used sendkeys instead and it worked 👍

  • @i_am_reshad
    @i_am_reshad Před 3 lety +1

    watched all 9

  • @joshibhushan1
    @joshibhushan1 Před 4 lety +1

    Hi Raghav, What if we are using simulator instead of actual device. Can you share the video to connect to simulator and then Appium Desktop or UI Automator

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Bhushan, I will plan for that

  • @sangavidamodharan7496
    @sangavidamodharan7496 Před rokem +1

    UIautomator.bat file is missing in my sdk package. Could you please help. TIA

    • @RaghavPal
      @RaghavPal  Před rokem

      Hi Sangavi, These user comments will help
      1. i had uiautomatorviewer.bat inside tools folder instead of tools/bin
      2. try getting sdk tools from androidsdkmanager.azurewebsites.net/SDKTools
      3. can also use Appium Desktop Inspector instead of uiautomator
      4. In case appium server is running you can try after stopping appium and then open uiautomatorviewer
      4. uiautomatorviewer and sdkmanager.bat usually works well with java 8
      stackoverflow.com/questions/49506036/uiautomatorviewer-error-could-not-create-the-java-virtual-machine
      5. For windows download the zip file from this link ,extract and continue it works. because the current file that we are downloading does not contain all files and folders required. try this.
      dl.google.com/android/repository/sdk-tools-windows-3859397.zip
      6. I'm getting 'unexpected error while obtaining ui hierarchy' when tried to take screen-shot using uiautomatorviewer on Mac - The issue got resolved by downgrading jdk from 1.8.261 to 1.8.231

  • @elmariscal5394
    @elmariscal5394 Před 4 lety

    Hi Raghav this is another way to inspect the elements isnt it? Do you recommend uiautomator against appium desktop to inspect? Cause i am using appium desktop nowadays

    • @RaghavPal
      @RaghavPal  Před 4 lety +1

      Both are good, uiautomatorviewer is a standard UI tool shipped as part of Android Studio for analyzing those UI components of your Android application. it is an inspector tool provided by Google that provides similar functionality to the Appium inspector tool

  • @mr.s.h.818
    @mr.s.h.818 Před rokem

    So UIAutomatorViewer is designed mainly to save screenshots(files) and use them without the need to plug in the device, right?

    • @RaghavPal
      @RaghavPal  Před rokem

      Hi Mr. S.H.,
      UI Automator Viewer is a tool provided by Android SDK which allows the user to inspect the UI elements of an Android application. It is mainly used for locating the UI elements on an Android app so that Appium can interact with them during automation testing.
      UI Automator Viewer can be used to capture screenshots of the UI elements of an Android application, which can be useful for debugging or troubleshooting purposes. However, it is not primarily designed for saving screenshots and using them without plugging in the device.

  • @sriharshakota3016
    @sriharshakota3016 Před 5 lety

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

  • @MarianoMC1988
    @MarianoMC1988 Před rokem

    Hi! Thank you so much!!! Great tutorial!! 😀. Just one quick question, Do we have available any tool that similarly Chropath enables us to test if the Xpath that we have created is finding the right element (Highlighting it)? Greetings from Argentina!

    • @RaghavPal
      @RaghavPal  Před rokem

      Hi Mariano, can check selectors hub

  • @mathivananjagan628
    @mathivananjagan628 Před 4 lety

    really useful bro.thanks for d video

  • @yogeshwaran1998
    @yogeshwaran1998 Před 4 lety +1

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

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Yogesh, what is your java ver. Can check this - stackoverflow.com/questions/46908523/uiautomatorviewer-batch-file-is-not-opening/51237395

    • @theriderpanda
      @theriderpanda Před 4 lety +1

      @@RaghavPal Hi, Raghav, I have downloaded the latest command-line zip file from developer.android.com/studio , "commandlinetools-win-6200805_latest.zip". After unzipping, the tools folder doesn't contain UIAutomatorViewer. FYI: I have java version-1.8.0_161

    • @sabbyk7
      @sabbyk7 Před 4 lety +1

      @@@RaghavPal
      I also tried the same thing by downloading the latest cmdlinezip file but no change.I am not able to see uiautomatorviewer.bat file in bin

  • @abhijitbiradar
    @abhijitbiradar Před 4 lety

    Hi, Thanks for this informative video. I have a query, which app you are using to show the mobile execution...?

  • @mzamomahaeng268
    @mzamomahaeng268 Před 2 lety

    legend

    • @mzamomahaeng268
      @mzamomahaeng268 Před 2 lety

      You are the best and you always make me look good at work because of you educational videos. Thank you

    • @RaghavPal
      @RaghavPal  Před 2 lety

      Most welcome Mzamo

  • @noname-ks6go
    @noname-ks6go Před 4 lety

    Starts from 3:00.

  • @TenseiShitaraSuraimuDattaKen

    Are we able to save images/videos using UIAutomatorViewer? For example if the app I was browsing instead was Twitter instead of calculator, all the elements for the Twitter would show up... including the png/mp4 right?

  • @ankitnigam1487
    @ankitnigam1487 Před 4 lety

    great job sr

  • @aishwaryalakshmi9977
    @aishwaryalakshmi9977 Před rokem

    hello..In my app, there is no id,no text..only index is mentioned. How can we locate the element?

    • @RaghavPal
      @RaghavPal  Před rokem

      Hi Aishwarya,
      In Appium, you can locate elements using various methods such as XPath, class name, accessibility id, etc. In your case, since the only attribute available is the index, you can use the index locator strategy to locate the element.
      Here's an example code snippet in JavaScript:
      // assuming driver is your Appium driver instance
      const element = await driver.findElement('android=new UiSelector().index(2)');
      In the above code snippet, we are using the android locator strategy since the app is an Android app. If it's an iOS app, you can use the ios locator strategy instead. The UiSelector().index(2) will locate the element based on its index value.
      You can also use the driver.findElements() method to locate multiple elements based on their index values. For example:
      const elements = await driver.findElements('android=new UiSelector().index(2)');
      This will return an array of elements that have an index of 2.
      Note that using the index locator strategy can be less reliable compared to using other attributes such as ids or accessibility ids. If possible, try to work with the app developers to add unique identifiers to the elements for easier and more reliable automation.

  • @teguhhariyadi7524
    @teguhhariyadi7524 Před 3 lety

    which is better, Appium Desktop Inspector or UIAutomatorViewer ? please explain the pros and cons

    • @RaghavPal
      @RaghavPal  Před 3 lety +1

      Hi both are good and have similar backend, See whats easier for you

  • @sunnysaurabh3426
    @sunnysaurabh3426 Před 2 lety

    Hi Raghav, uiautomatorviewer is launched but I am unable to capture screenshorts, no action is performed on uiautomatorviewer can you please help??

    • @RaghavPal
      @RaghavPal  Před 2 lety

      Hi Sunny, pls check if the appium server is running, if yes, try to stop and try again

  • @lakshmikondaraavi
    @lakshmikondaraavi Před 2 měsíci

    Hi sir, I am unable to view UI Automator viewer after installing android studio and environment variable setup, getting error like C:\Users\Admin\AppData\Local\Android\Sdk\tools\bin>uiautomatorviewer.bat
    Error: Could not find or load main class com.android.uiautomator.UiAutomatorViewer
    Caused by: java.lang.ClassNotFoundException: com.android.uiautomator.UiAutomatorViewer
    C:\Users\Admin\AppData\Local\Android\Sdk\tools\bin>
    Please suggest me how to evaluate this issue?

    • @RaghavPal
      @RaghavPal  Před 2 měsíci

      Lakshmi
      It seems you're encountering an issue with running UiAutomatorViewer in Android Studio. Let's troubleshoot this! Here are some steps you can follow:
      1. Check Java Version:
      - Ensure that you have Java 8 installed. UiAutomatorViewer might not work with newer Java versions.
      - If you're using a different version, consider downgrading to Java 8¹.
      2. Set JAVA_HOME Environment Variable:
      - Make sure you've set the `JAVA_HOME` environment variable to point to your Java 8 installation directory (e.g., `C:\Program Files\Java\jdk1.8.0_311`).
      - You can add it in your system or user environment variables³.
      3. Run UiAutomatorViewer:
      - Open a command prompt (cmd) as an administrator.
      - Navigate to the `tools/bin` directory inside your Android SDK folder (e.g., `C:\Users\Admin\AppData\Local\Android\Sdk\tools\bin`).
      - Execute the command: `uiautomatorviewer.bat`.
      Hopefully, following these steps will resolve the issue
      -

  • @Ashokkumarg8
    @Ashokkumarg8 Před 4 lety

    Basically, the class name is a attribute/locator right? but you have used it as a tag name.
    This is how we use for Xpath: //TagName[@Attribute=Value], can we use as you mentioned also?

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Yes, Ashok, If you need more help with XPath can watch this - czcams.com/play/PLhW3qG5bs-L83gLEZVIDHOvgTTz27po_0.html

  • @ozlemsahin9121
    @ozlemsahin9121 Před 8 měsíci

    I can not click "back " button . It is not part of Ui. How can I go back?

    • @RaghavPal
      @RaghavPal  Před 8 měsíci

      Ozlem
      If you're unable to click the "back" button using UI Automator Viewer because it's not directly detected as a UI element, you can still navigate back in the app using alternative methods. Here are a couple of approaches you can try:
      1. **Simulate Swipe Gesture:** You can simulate a swipe gesture from right to left on the screen to navigate back. Use the `UiDevice` class to perform the swipe gesture. For instance:
      ```java
      UiDevice device = UiDevice.getInstance();
      device.swipe(device.getDisplayWidth() * 0.8f, device.getDisplayHeight() * 0.5f, device.getDisplayWidth() * 0.2f, device.getDisplayHeight() * 0.5f, 500);
      ```
      2. **Use KeyEvent:** You can simulate pressing the "back" button using the `KeyEvent` class. For example:
      ```java
      Runtime.getRuntime().exec("/system/bin/input keyevent 4");
      ```
      Before attempting these methods, ensure that your UI Automator script has successfully connected to the device and the app is running in the foreground.

  • @rahul8058kashyap
    @rahul8058kashyap Před 4 lety

    Hello Raghav, i have created a calculator project. Whenever i try to run my project, it launches the Calculator app in emulator but its not performing the events like clicking on 2 and plus symbol. How to share the screenshot of error which i am getting ?

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Rahul, you will need to check the detailed logs and troubleshoot. If you still cannot resolve it. Then message me with the steps you have tried.

  • @Top10withJustin
    @Top10withJustin Před 2 lety

    Hi Raghav, i couldn't fine uiautomator.bat file in my bin folder can you help me with that?

    • @RaghavPal
      @RaghavPal  Před 2 lety

      Hi, These user comments will help
      1. i had uiautomatorviewer.bat inside tools folder instead of tools/bin
      2. try getting sdk tools from androidsdkmanager.azurewebsites.net/SDKTools
      3. can also use Appium Desktop Inspector instead of uiautomator
      4. In case appium server is running you can try after stopping appium and then open uiautomatorviewer
      4. uiautomatorviewer and sdkmanager.bat usually works well with java 8
      stackoverflow.com/questions/49506036/uiautomatorviewer-error-could-not-create-the-java-virtual-machine
      5. For windows download the zip file from this link ,extract and continue it works. because the current file that we are downloading does not contain all files and folders required. try this.
      dl.google.com/android/repository/sdk-tools-windows-3859397.zip
      6. I'm getting 'unexpected error while obtaining ui hierarchy' when tried to take screen-shot using uiautomatorviewer on Mac - The issue got resolved by downgrading jdk from 1.8.261 to 1.8.231

  • @veenayadav6995
    @veenayadav6995 Před 3 lety

    Hi I am not able to open UIAUtomator tool from cmd as well as from bin folder. It is giving me error "-Djava.ext.dirs=..\lib\x86_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.". My jdk version is 15.0.2, Android Studio Version 4.1, Appium v 1.19.1

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi Veena, As per most users comments, it worked well with java 8
      stackoverflow.com/questions/49506036/uiautomatorviewer-error-could-not-create-the-java-virtual-machine

  • @kapilrana2361
    @kapilrana2361 Před 5 lety

    Hi Raghav, I am getting below error message pop-up while taking the screenshot using uiautomatorviewer.
    "Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!
    "
    I have check my device is connect: using adb devices.

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Kapil try to restart server again. Check this - stackoverflow.com/questions/40214342/error-obtaining-ui-hierarchy-error-while-obtaining-ui-hierarchy-xml-file-com-an

  • @sabakanwal714
    @sabakanwal714 Před 3 lety

    Thank you for a nice tutorial. Is it possible to get layout inspection without direct interaction with layout? I mean if we run a test case from eclipse or android studio then is it possible to get automated layout inspection alongside each step of test case being played on a device? Can I get this with any other mobile testing tool? Any guidance will be highly appreciated!

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi Saba,
      You can try TestProject - czcams.com/play/PLhW3qG5bs-L_QuqpGY-B-1ifP1j4ve3fx.html
      Thanks,
      Raghav

  • @LeMinh-lo5xm
    @LeMinh-lo5xm Před 4 lety

    you are legend

    • @RaghavPal
      @RaghavPal  Před 4 lety

      So happy and humbled to see this Le Minh

  • @sandhyavanga718
    @sandhyavanga718 Před 2 lety

    Hi Raghav,
    When I open the uiautomatorviewer file in the terminal on mac getting this error:
    Could not find or load main class com.android.uiautomator.UiautomatorViewer, I have set all the paths SDK, platform-tools and have installed java. Please help me how to fix this.

    • @RaghavPal
      @RaghavPal  Před 2 lety

      Hi Sandhya, can check this stackoverflow.com/questions/40718487/error-could-not-find-or-load-main-class-com-android-uiautomator-uiautomatorview

  • @mathimahalingam4413
    @mathimahalingam4413 Před 2 lety

    Hi Raghav, thanks for this course. i am getting the following error while running uiautomatorviewer.bat, I don't know how to fix and continue further, Do you know why i am getting this error?
    C:\Users\AppData\Local\Android\Sdk\tools\bin>uiautomatorviewer.bat
    -Djava.ext.dirs=..\lib\x86_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.

    • @RaghavPal
      @RaghavPal  Před 2 lety

      Hi Mathi, this can help stackoverflow.com/questions/18459945/how-to-solve-could-not-create-the-virtual-machine-error-of-java-virtual-machine

  • @shielamariemendoza1690

    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.

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Shiela, Pls check if the installation was proper. Can try reinstalling OR for iOS you can check this discuss.appium.io/t/what-are-the-best-tools-to-find-element-locators-for-ios-apps/4509
      kobiton.com/book/chapter-6-walkthrough-of-uiautomator-for-android-and-accessibility-inspector-for-ios-for-element-extraction-2/

  • @ajayjaiswal7365
    @ajayjaiswal7365 Před 3 lety +1

    Hi Raghav, could you please make a video on how to locate elements in web view in native app?

  • @goldenearth5258
    @goldenearth5258 Před 4 lety

    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

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Mayur, try to use some other locator for this

  • @jnp9155
    @jnp9155 Před 2 lety

    C:\Users\SPURGE\AppData\Local\Android\Sdk\tools\bin>uiautomatorviewer.bat
    -Djava.ext.dirs=..\lib\x86_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.
    This error i am getting while executing uiautomatorviewer.bat on cmd prompt
    what do to resolve it?

    • @RaghavPal
      @RaghavPal  Před 2 lety

      Hi Jayesh, Hi, What is your java ver.
      You can check on cmd with command
      java -version.
      uiautomatorviewer and sdkmanager.bat usually works well with java 8
      stackoverflow.com/questions/46402772/failed-to-install-android-sdk-java-lang-noclassdeffounderror-javax-xml-bind-a
      stackoverflow.com/questions/49506036/uiautomatorviewer-error-could-not-create-the-java-virtual-machine

  • @SiddharthKaleFilms
    @SiddharthKaleFilms Před 9 dny

    Appium inspector already supports this then why we need uiautomater ?

    • @RaghavPal
      @RaghavPal  Před 8 dny +1

      Siddharth
      Let's break down the question and provide a step-by-step explanation.
      Step 1: Understand Appium Inspector
      Appium Inspector is a tool provided by Appium, an open-source test automation framework, to inspect and identify UI elements of mobile applications. It allows users to:
      * Launch the application on a mobile device or emulator
      * Inspect the application's UI elements, such as buttons, text fields, and labels
      * Get the properties and attributes of these elements, like their XPath, ID, or class name
      * Use this information to write automation tests
      Step 2: Understand UiAutomator
      UiAutomator is a testing framework provided by Google for Android devices. It allows users to write automated tests for Android applications using Java or Python. UiAutomator provides a way to interact with the device's UI, such as:
      * Performing actions like clicks, swipes, and long presses
      * Verifying the existence and properties of UI elements
      * Automating user interactions and testing application functionality
      Step 3: Identify the differences between Appium Inspector and UiAutomator
      While both tools are used for mobile automation testing, they serve different purposes:
      * Appium Inspector is primarily used for element inspection and identification, whereas UiAutomator is a full-fledged testing framework for automating user interactions and testing application functionality.
      * Appium Inspector supports multiple platforms, including iOS and Android, whereas UiAutomator is specific to Android devices.
      * Appium Inspector is part of the Appium ecosystem, which provides a unified testing framework across multiple platforms, whereas UiAutomator is a native Android testing framework.
      Step 4: Answer the question
      So, why do we need UiAutomator if Appium Inspector already supports element inspection?
      The answer lies in the differences mentioned above. While Appium Inspector provides a convenient way to inspect and identify UI elements, it is not a full-fledged testing framework like UiAutomator. UiAutomator offers more advanced features for automating user interactions and testing application functionality, which are not available in Appium Inspector.
      Additionally, UiAutomator is a native Android testing framework, which provides better performance and more precise control over Android-specific features and APIs. Appium Inspector, on the other hand, is a cross-platform tool that may not provide the same level of native integration and performance on Android devices.
      --

  • @praveenguptaful
    @praveenguptaful Před 4 lety

    Hi Raghav ,
    I have downloaded platform tools and other sdk data from Android studio but i didn't get tools folder in it .
    Although my automation is running Fine but it takes too time to launch.
    I also tried to download from command line zip folder in which also tools folde is missing

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Praveen, try getting sdk tools from androidsdkmanager.azurewebsites.net/SDKTools

  • @manojlonar4912
    @manojlonar4912 Před 4 lety

    Hi Raghav,
    I'm getting the following error
    Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!
    1. My appium server is off.
    2. Restarted adb
    3. Restarted emulator many times.
    No remedy.
    Please help!!

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Manoj, pls check if this helps - stackoverflow.com/questions/40214342/error-obtaining-ui-hierarchy-error-while-obtaining-ui-hierarchy-xml-file-com-an

  • @poojayadav-hy5xv
    @poojayadav-hy5xv Před 4 lety

    Hey sir,
    I m getting an error org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters.while using all the parameters so for that what I will do now? Used for my particular app, not for calculator

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Pooja, you can try adding some wait time, Also ensure the object locators are provided correctly

  • @asarudeenb9499
    @asarudeenb9499 Před 2 lety

    Hello, Raghav bro. We have owned the android application. in that App, the Elements was not locating while running the script. Actually, i tried in many ways like xpath, id and name also for the particular element. but, the Action not worked when run the script. Calculator app was working fine. in same way I tried in our Owned App which is not working. executed in "appium desktop inpector" and "uiautomator". Please help me with this...!

    • @RaghavPal
      @RaghavPal  Před 2 lety +1

      Hi Asarudeen, will need to check the details and logs, Can try some other example online

  • @techzoo534
    @techzoo534 Před rokem

    Facing some issue to open ui automator viewer. when I try to open ui automator by double click uiautomatorviewer.bat
    File or also tried to open with cmd but in both cases my ui automator viewer not open.
    Please help.
    Note: my physical device successfully appear in cmd. Means device connected with laptop.

    • @RaghavPal
      @RaghavPal  Před rokem

      Hi, this can help stackoverflow.com/questions/49199331/ui-automater-viwer-is-not-opening

  • @christopherquiambao4591

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

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Christopher, wil need to check more on this online. This may help -
      discuss.appium.io/t/how-to-identify-webview-elements-in-android-hybrid-app/5140/3

  • @saimohithgattu5546
    @saimohithgattu5546 Před 4 lety

    Hi Raghav,
    I have connected my mobile phone it is showing in vysor as well as on cmd when i type adb devices.
    But when i open the UIAutomatorViewer by clicking on the batch file and after it gets opened when i click on the device screenshot button it gives me an error saying " unable to connect to adb. check if adb is installed correctly"
    Can you help me in this?

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Sai, check if this helps stackoverflow.com/questions/27734121/unable-to-connect-to-adb-check-if-adb-is-installed-correctly

    • @saimohithgattu5546
      @saimohithgattu5546 Před 4 lety

      @@RaghavPal Thank you so much Raghav everything is working fine now.Thanks for the information

  • @shivasankaran5552
    @shivasankaran5552 Před 5 lety

    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: com.android.ddmlib.SyncException: Remote object doesn't exist!]"

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Shiva, is your appium server running. Try to stop it and try again. Also restart adb server
      sudo adb kill-serversudo adb start-server

  • @nehalahoti5749
    @nehalahoti5749 Před 3 lety

    Hi Raghav - I am getting the following error while loading the device in UIautomator
    "Error obtaining UI hierarchy
    Reason:
    Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!" It might be becuase of old version of uiautomator ..I tried installing uiautomator2.But I am not able to install it..Can you please guide me for this issue?

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi Neha, reload your screen again stackoverflow.com/questions/40214342/error-obtaining-ui-hierarchy-error-while-obtaining-ui-hierarchy-xml-file-com-an

  • @kedardegaonkar
    @kedardegaonkar Před 3 lety

    Hi Raghav. Need your help please on this.
    I'm getting 'unexpected error while obtaining ui hierarchy' when tried to take screen-shot using uiautomatorviewer on Mac

    • @RaghavPal
      @RaghavPal  Před 3 lety +1

      Hi Kedar, will need to check the error details, ensure that appium server is not running on the same port and the device is connected

    • @kedardegaonkar
      @kedardegaonkar Před 3 lety

      @@RaghavPal Thanks so very much Raghav for your reply. The issue got resolved by downgrading jdk from 1.8.261 to 1.8.231.

  • @yagomorales7434
    @yagomorales7434 Před 11 měsíci

    I need to connect uiautomatorviewer with Memu Play emulator, but I can't. Would you give me any advice?
    From already thank you very much.

    • @RaghavPal
      @RaghavPal  Před 11 měsíci

      Yago
      To connect uiautomatorviewer with Memu Play emulator, you can follow these steps:
      1. *Install the Memu Play emulator.*
      2. *Install uiautomatorviewer.*
      3. *Connect your Memu Play emulator to your computer using USB.*
      4. *Start the Memu Play emulator.*
      5. *Open uiautomatorviewer.*
      6. *In the uiautomatorviewer toolbar, click the "Window" menu and select "Devices."*
      7. *In the "Devices" window, select your Memu Play emulator and click the "Connect" button.*
      *Troubleshooting:*
      * If you are unable to connect to your Memu Play emulator, try the following:
      * Make sure that your Memu Play emulator is running.
      * Make sure that your computer is connected to the internet.
      * Try restarting your computer and the Memu Play emulator.
      * Try connecting to your Memu Play emulator using a different USB cable.
      * If you are still unable to connect to your Memu Play emulator, you can try using the following command:
      ```
      adb connect localhost:5555
      ```
      *Note:* You will need to have the Android SDK installed on your computer to use this command.
      Once you are connected to your Memu Play emulator, you can use uiautomatorviewer to inspect the UI elements of your app and automate actions.

  • @mangkanor4017
    @mangkanor4017 Před rokem

    Sir, it seems like the uiautimator viewer bat file is not inculded in the latest version of sdk manager. Are there any alternatives for this or can I ask for a copy for the .bat file, I really wanna learn how to automate.

    • @RaghavPal
      @RaghavPal  Před rokem

      This user comment can help:
      These user comments will help
      1. i had uiautomatorviewer.bat inside tools folder instead of tools/bin
      2. try getting sdk tools from androidsdkmanager.azurewebsites.net/SDKTools
      3. can also use Appium Desktop Inspector instead of uiautomator
      4. In case appium server is running you can try after stopping appium and then open uiautomatorviewer
      4. uiautomatorviewer and sdkmanager.bat usually works well with java 8
      stackoverflow.com/questions/49506036/uiautomatorviewer-error-could-not-create-the-java-virtual-machine
      5. For windows download the zip file from this link ,extract and continue it works. because the current file that we are downloading does not contain all files and folders required. try this.
      dl.google.com/android/repository/sdk-tools-windows-3859397.zip
      6. I'm getting 'unexpected error while obtaining ui hierarchy' when tried to take screen-shot using uiautomatorviewer on Mac - The issue got resolved by downgrading jdk from 1.8.261 to 1.8.231

  • @jonestako4721
    @jonestako4721 Před 5 lety +1

    thanks

  • @abhikatta2883
    @abhikatta2883 Před 3 lety

    Hi Raghav i cant see the ui automatorviewer run.bat

    • @RaghavPal
      @RaghavPal  Před 3 lety +1

      Hi Abhi, These user comments will help
      1. i had uiautomatorviewer.bat inside tools folder instead of tools/bin
      2. try getting sdk tools from androidsdkmanager.azurewebsites.net/SDKTools
      3. can also use Appium Desktop Inspector instead of uiautomator
      4. In case appium server is running you can try after stopping appium and then open uiautomatorviewer
      4. uiautomatorviewer and sdkmanager.bat usually works well with java 8
      stackoverflow.com/questions/49506036/uiautomatorviewer-error-could-not-create-the-java-virtual-machine
      5. For windows download the zip file from this link ,extract and continue it works. because the current file that we are downloading does not contain all files and folders required. try this.
      dl.google.com/android/repository/sdk-tools-windows-3859397.zip
      6. I'm getting 'unexpected error while obtaining ui hierarchy' when tried to take screen-shot using uiautomatorviewer on Mac - The issue got resolved by downgrading jdk from 1.8.261 to 1.8.231

  • @chandumangam1777
    @chandumangam1777 Před 3 lety

    hi Raghav, I am facing issue with the following error regarding uiautomator , tried many ways but no solved with the issue please help me out!!
    Error while obtaining UI hierarchy XML file: com.android.ddmlib.SyncException: Remote object doesn't exist!

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Pls check this stackoverflow.com/questions/25201743/error-in-using-uiautomatorviewer-for-testing-android-app-in-appium

    • @chandumangam1777
      @chandumangam1777 Před 3 lety

      @@RaghavPal issue not resolved yet

    • @RaghavPal
      @RaghavPal  Před 3 lety

      In case I get any more info, will share with you

  • @simpletech3009
    @simpletech3009 Před 3 lety

    HI Raghav very good video can you create one video android studio app how to run appium

  • @syedhannan8588
    @syedhannan8588 Před 4 lety

    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

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Syed, pls check this stackoverflow.com/questions/27734121/unable-to-connect-to-adb-check-if-adb-is-installed-correctly?rq=1
      Can also check this
      Step 1: You know where your android-sdk is installed in your system if you didnt changed the location search in ProgramFiles/Android
      Step 2: close eclipse.
      Step 3: Copy adb.exe in android-sdk/platform-tools/ folder
      Step 4: Paste that adb.exe in android-sdk/tools/ folder
      Step 5: Now open eclipse go to Windows --> Preferences choose android then click browse and select android-sdk with in few minutes
      stackoverflow.com/questions/6361349/android-problem-eclipse-cannot-find-adb-exe

    • @goshar17
      @goshar17 Před 3 lety

      @@RaghavPal But i m unable to see the Android option in the Windows->preferences section

  • @ashishjain8003
    @ashishjain8003 Před 3 lety

    I have updated sdk file and in the latest sdk, uiautomator is missing
    is there an any alternative of the this? or am I missing something here

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi Ashish, try getting sdk tools from androidsdkmanager.azurewebsites.net/SDKTools

  • @krishna_raj9331
    @krishna_raj9331 Před rokem

    Hello Sir.
    If we connect our mobile with laptop, is there any possibility of some virus coming into the mobile from the laptop.?

    • @RaghavPal
      @RaghavPal  Před rokem

      Hi Krishna, we cannot rule out the possibility, Just have good anti-virus softwares installed. Also it is recommended to use device that you do not use for your primary use

  • @gowthamp7202
    @gowthamp7202 Před rokem +1

    can you pleace make a video on appium python using pycharm for android

  • @prodre1
    @prodre1 Před rokem

    How about using typescript? Do you also have video's for it?

  • @yaminiuppal5060
    @yaminiuppal5060 Před 3 lety

    Hi, I am getting this error while running "uiautomatorviewer" command:
    Djava.ext.dirs=/Users/yamini/Library/Android/sdk/tools/lib/x86_64:/Users/yamini/Library/Android/sdk/tools/lib is not supported. Use -classpath instead.
    Error: Could not create the Java Virtual Machine.

    • @RaghavPal
      @RaghavPal  Před 3 lety +1

      Hi Yamini, What is your java ver.
      You can check on cmd with command
      java -version.
      uiautomatorviewer and sdkmanager.bat usually works well with java 8
      stackoverflow.com/questions/46402772/failed-to-install-android-sdk-java-lang-noclassdeffounderror-javax-xml-bind-a
      stackoverflow.com/questions/49506036/uiautomatorviewer-error-could-not-create-the-java-virtual-machine

    • @yaminiuppal5060
      @yaminiuppal5060 Před 3 lety

      @@RaghavPal Hi Raghav, Thanks for your reply. I checked and my java version is "11.0.2". I don't want to downgrade my java. Is it possible to use multiple java versions for different software?

    • @RaghavPal
      @RaghavPal  Před 3 lety +1

      Hi Yamini, For Java 11 Reference: stackoverflow.com/questions/60440509/android-command-line-tools-sdkmanager-always-shows-warning-could-not-create-se
      1. Download latest Command line tools from android i.e. commandlinetools-win-6200805_latest.zip
      2. Unzip the downloaded file
      3. Create directory for storing commandline tools somewhere on your disk, with following path included: android/cmdline-tools/latest. Basically when You unzip this Cmd line tools, just rename tools directory to latest and make sure You put this latest folder in android/cmdline-tools directory somewhere on your disk
      4. Create ANDROID_HOME environment variable for directory that stores the cmdline tools directory location like: C:\YourLocationWhereYouStoreTheDirectory\android\cmdline-tools\latest
      5. Create new entry in Path environment variable as %ANDROID_HOME%\bin
      Also check other comments

  • @ravinaidu4035
    @ravinaidu4035 Před 5 lety

    Hiii raghav my usb cable connected device is not showing in list of devices (redmi 4)

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Ravi, pls check
      1. Dev mode enabled on Device
      2. USB debugging is on on Device
      3. Check your java version
      java -v
      I have child with java 8

  • @lokeshs887
    @lokeshs887 Před 4 lety

    UIAutomator viewer .bat file is not found in latest version.Can you pls say, is there any other solution for finding the locators?sir

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Lokesh, you can also use Appium Desktop Inspector

  • @poojasankhe1349
    @poojasankhe1349 Před 3 lety

    Hi while running the uiautomatorviewer.bat file I get the below error. I am using jdk 15.0.2. I set all the paths but still getting below error. Please help me
    -Djava.ext.dirs=..\lib\x86_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.

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi Pooja, What is your java ver.
      You can check on cmd with command
      java -version.
      uiautomatorviewer and sdkmanager.bat usually works well with java 8
      Also check this:
      stackoverflow.com/questions/46402772/failed-to-install-android-sdk-java-lang-noclassdeffounderror-javax-xml-bind-a
      stackoverflow.com/questions/49506036/uiautomatorviewer-error-could-not-create-the-java-virtual-machine

    • @poojasankhe1349
      @poojasankhe1349 Před 3 lety

      @@RaghavPal i am using 15.0.2 java is there any other way to open the uiautomatorviewer.

    • @RaghavPal
      @RaghavPal  Před 3 lety

      will need to check on this

    • @poojasankhe1349
      @poojasankhe1349 Před 3 lety

      @@RaghavPal ok sure if u get the solution just let me know

  • @akhilpokuri5432
    @akhilpokuri5432 Před 4 lety

    Hello Raghav, can you suggest how to change the image orientation in Uiautomatorviewer , mine is gaming application. I am looking for landscape mode instead of portrait mode.

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Pokuri, I have not tried myself but you can change screen orientation while testing with appium - appium.io/docs/en/commands/session/orientation/set-orientation/

    • @akhilpokuri5432
      @akhilpokuri5432 Před 4 lety

      Thanks Raghav for your quick response.

  • @christopherquiambao4591

    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

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Christopher, not sure if something has changed. Will need to check online

    • @theriderpanda
      @theriderpanda Před 4 lety +1

      @@RaghavPal Yes, it is changed. Kindly update.

    • @heisonmoreno9837
      @heisonmoreno9837 Před 4 lety

      @@theriderpanda Hi, How does it work now? I don´t have automator viewer in my folder.

    • @eshantverma3656
      @eshantverma3656 Před 4 lety

      @@RaghavPal Sir i am facing the same issue. UI Automator Viewer.bat file is missing in the latest android sdk folder(i.e Android-sdk/tools/bin). please help where to find it.
      commandlinetools-win-6609375_latest.zip

    • @nagarajediger3486
      @nagarajediger3486 Před rokem

      I am also facing same issue, please can some help me ASAP

  • @bharatapar3937
    @bharatapar3937 Před 5 lety

    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?

    • @qababuworks
      @qababuworks Před 5 lety +1

      Keep on trying you will get it, even I faced it. Restart uiautomatviewer, try again like 5-8 times.

    • @love_soni
      @love_soni Před 5 lety +1

      And make sure device is connected and appium server is not running

    • @RaghavPal
      @RaghavPal  Před 5 lety +2

      Thanks for adding your inputs Love & QABABU.COM

    • @ashuchaudhary3707
      @ashuchaudhary3707 Před 4 lety

      I'm still getting this error. How did you fix it?

  • @shyamsawale4593
    @shyamsawale4593 Před rokem

    Iam getting error Exception in thread main.java.lang.unsupportedclassversion mejor: minor version 52 when I open uiautomatorviewer please suggest me solution.

    • @RaghavPal
      @RaghavPal  Před rokem

      Hi Shyam,
      The error "Exception in thread main.java.lang.unsupportedclassversion: mejor: minor version 52" occurs when you are trying to run a Java class that was compiled with a newer version of the Java SDK than the version you have installed on your machine
      Here are a few things you can try to fix the issue:
      Make sure you have the latest version of Java installed on your machine
      Check the version of java installed on your machine and update it if necessary
      Check the version of java that the Uiautomatorviewer is compiled with, it should be compatible with the version you have installed on your machine
      Make sure that the JAVA_HOME environment variable is set to the correct Java SDK installation folder
      Try to run the command with the latest version of java. e.g. java -jar uiautomatorviewer.jar
      Try to run the command by specifying the path of the Java executable. e.g. "path-to-java\bin\java.exe" -jar uiautomatorviewer.jar
      Try to re-install the Uiautomatorviewer and ensure that you have the latest version of the software.
      Check the compatibility of Uiautomatorviewer with your operating system, some version of Uiautomatorviewer may not work properly on your operating system

    • @shyamsawale4593
      @shyamsawale4593 Před rokem

      Thank you ,
      I was trying slove this exception last 3 month but i couldn't slove now it's working 😀🙏

  • @titopartian561
    @titopartian561 Před 4 lety

    when i type uiautomatorviewer.bat by cmd then i faced this issue plz help me?
    -Djava.ext.dirs=..\lib\x86_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.

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Akaash, what is your java version, You can try 2 things
      1. try getting sdk tools from androidsdkmanager.azurewebsites.net/SDKTools
      2. Use Java 8 and try again

    • @nikeshdevkota8685
      @nikeshdevkota8685 Před 4 lety

      @@RaghavPal I am having the same problem , my jdk version is jdk-14.0.2 and I have updated android sdk build tools from 26 and above from sdk manager along with updating sdk platforms . I am still getting the same error when I type uiautomatorviewer.bat in command prompt. If I do it from the tools section, uiautomatorviewer.bat will open a blank cmd and close it withinn a sec.
      C:\Android_sdk\sdk\tools> uiautomatorviewer.bat
      -Djava.ext.dirs=lib\x86_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.

  • @rudrakshgandhar3381
    @rudrakshgandhar3381 Před 5 lety

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

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Rudraksh, what is the error you are getting Pls see if this helps - stackoverflow.com/questions/18658322/unable-to-start-uiautomatorviewer

  • @juliacane7867
    @juliacane7867 Před 3 lety

    resource-id is missing in my project...
    how can I find it?

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi Julia, it may be that dev team or framework did not add it. You can ask to the dev team or check other properties that can uniquely identify the element

  • @RahulSingh-ic5vy
    @RahulSingh-ic5vy Před 2 lety

    Hi Raghav I am using selenium 4.1.1 version and appium driver in my framework and driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(text(\"Rahul \"));"); is not working it is giving message " The method findElementByAndroidUIAutomator(String) is undefined for the type AppiumDriver" plaese suggest how to solve this.

    • @RaghavPal
      @RaghavPal  Před 2 lety

      Hi Rahul, pls check this - stackoverflow.com/questions/56710457/cannot-find-findelementbyandroiduiautomator-method-for-appium-android-driver

    • @RahulSingh-ic5vy
      @RahulSingh-ic5vy Před 2 lety

      @@RaghavPal Hi Raghav Thanks for the response. I followed the link and this doesn't solve the problem with selenium 4.1 and java client 8.0.0 beta 2 . It seems TouchAction is deprecated. Any suggestions how to do scrolling or other action in mobile automation.

  • @pavithrar1725
    @pavithrar1725 Před 3 lety

    Uiautomator.bat is not available for me

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi Pavithra, I am listing all user comments related to UIAutomator.
      These user comments will help
      1. i had uiautomatorviewer.bat inside tools folder instead of tools/bin
      2. try getting sdk tools from androidsdkmanager.azurewebsites.net/SDKTools
      3. can also use Appium Desktop Inspector instead of uiautomator
      4. In case appium server is running you can try after stopping appium and then open uiautomatorviewer
      4. uiautomatorviewer and sdkmanager.bat usually works well with java 8
      stackoverflow.com/questions/49506036/uiautomatorviewer-error-could-not-create-the-java-virtual-machine
      5. For windows download the zip file from this link ,extract and continue it works. because the current file that we are downloading does not contain all files and folders required. try this.
      dl.google.com/android/repository/sdk-tools-windows-3859397.zip
      6. I'm getting 'unexpected error while obtaining ui hierarchy' when tried to take screen-shot using uiautomatorviewer on Mac - The issue got resolved by downgrading jdk from 1.8.261 to 1.8.231

  • @MrigankaAulia
    @MrigankaAulia Před 3 lety

    I am using commandlinetools(win-6858069) but there is no uiautomatorviewer.bat file inside cmdline-tools\bin. What to do ?

    • @RaghavPal
      @RaghavPal  Před 3 lety

      try getting sdk tools from androidsdkmanager.azurewebsites.net/SDKTools

    • @MrigankaAulia
      @MrigankaAulia Před 3 lety

      @@RaghavPal I have downloaded both the SDK tools(version 25 and 26) but sdkmanager.bat does not seem to work may be due to some missing features (Java EE modules) in the latest java version. Is there any other solution that can work with the latest java version? Or may be any other solution of the real problem that is another app/trick that will work like uiautomatorviewer( appium inspector does not seem to work that finely ).

    • @RaghavPal
      @RaghavPal  Před 3 lety

      will check more on this

    • @shwethavijaykumar7222
      @shwethavijaykumar7222 Před 3 lety

      i had uiautomatorviewer.bat inside tools folder instead of tools/bin,

  • @murthyariga4689
    @murthyariga4689 Před 4 lety

    I tried and getting this error, can any one help.
    Android\Sdk\tools\bin>sdkmanager "platform-tools" "platforms;android-29"
    Error: Could not find or load main class com.android.sdklib.tool.sdkmanager.SdkManagerCli

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Hi Murthy, try getting sdk tools from androidsdkmanager.azurewebsites.net/SDKTools

  • @mariamahmed33
    @mariamahmed33 Před 4 lety

    What app can i use to capture my phone behavior during mobile automation using real device?

  • @karloxvilla
    @karloxvilla Před 4 lety

    Hi Raghav, thanks for all courses of your channel. Could you help me with this error, when I open the uiautomatorviewer and I click in Device Screenchot button, it always appears the error: Unexpected error while obtaining UI hierarchy

    • @KajalKumari-qm2vu
      @KajalKumari-qm2vu Před 4 lety

      Hi Karlox...you need to disconnect and then again reconnect the adb device. Once the device gets connected it will work.

    • @karloxvilla
      @karloxvilla Před 4 lety

      @@KajalKumari-qm2vu Hi Kajal, thanks for your answer but this hasn´t been the solution

    • @RaghavPal
      @RaghavPal  Před 4 lety

      Make sure appium server is not running or use diff ports. Also ensure your device is unlocked and usb debugging is enabled

    • @karloxvilla
      @karloxvilla Před 4 lety

      ​@@RaghavPal. Thanks for the answer. I had an error, my android version is 10 and I was using sdkmanager "platform-tools" "platforms;android-28" instead of android-29. The error is solved.

    • @karloxvilla
      @karloxvilla Před 4 lety +1

      @@KajalKumari-qm2vu Thanks for your answer. I had an error, my android version is 10 and I was using sdkmanager "platform-tools" "platforms;android-28" instead of android-29. The error is solved.

  • @rnapsable
    @rnapsable Před 3 lety

    tools/bin not uiautomator present

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi Rahul, pls check other comments on this video, can help

  • @shivasai6807
    @shivasai6807 Před 3 lety

    hi ragav, i have downloaded sdk-tools form the following link,
    developer.android.com/studio
    after unzipping i couldn't kind uiautomatoviewer in it. Can you please help me out in finding uiautomatorviewer

    • @RaghavPal
      @RaghavPal  Před 3 lety

      Hi Shiva, try getting sdk tools from androidsdkmanager.azurewebsites.net/SDKTools

  • @A.B.00007
    @A.B.00007 Před 5 lety

    Hello Again. I am getting an "NoSuchElementException" for Xpath, any comments??

    • @RaghavPal
      @RaghavPal  Před 5 lety

      HI Asif, you will have to troubleshoot and check some other locator that can work

  • @shivasankaran5552
    @shivasankaran5552 Před 5 lety

    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.

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Shiva, have to tried with Appium desktop inspector. Check if you are getting same results.

    • @shivasankaran5552
      @shivasankaran5552 Před 5 lety

      @@RaghavPal yeah I tried with appium desktop inspector too.. since clickable=false, my script isn't clicking on the element. I guess I should use xy coordinates. But not sure how it is with appium. If you have any code snippet please share in the comments

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Shiva, as of now I do not have anything handy for this. Will have to get some online help

    • @shivasankaran5552
      @shivasankaran5552 Před 5 lety

      @@RaghavPal then make a video on this please.

    • @RaghavPal
      @RaghavPal  Před 5 lety

      I will do Shiva

  • @who__dares2846
    @who__dares2846 Před 2 lety

    can you do a video about installing older eclipse ide versions for java 8? I keep getting error that reads can't start java virtual machine or something similar.

    • @RaghavPal
      @RaghavPal  Před 2 lety

      I will check on this

    • @who__dares2846
      @who__dares2846 Před 2 lety

      @@RaghavPal please do. uiautomatorviewer only works with java 8, and I haven't been able to proceed any further cause I can't install eclipse that supports java 8 on my Mac.

    • @RaghavPal
      @RaghavPal  Před 2 lety

      okay, will update if I find more info

  • @ashutoshkumar1910
    @ashutoshkumar1910 Před 5 lety

    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

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Hi Ashutosh, try after stopping appium server

    • @ashutoshkumar1910
      @ashutoshkumar1910 Před 5 lety

      @@RaghavPal i did that.. it's not working.. as of now i am using appium desktop inspector.

    • @RaghavPal
      @RaghavPal  Před 5 lety

      Ok you can continue with that for now.

  • @mobistarc1872
    @mobistarc1872 Před 3 lety

    How to deploy it on cloud and run against your phone in hand(ie not cloud device farm) via 4G without a pc or usb cable?

    • @RaghavPal
      @RaghavPal  Před 3 lety

      This can help czcams.com/video/uw1Inr1wAiA/video.html

    • @mobistarc1872
      @mobistarc1872 Před 3 lety

      @@RaghavPal this is via tcpip not over public internet. I don't have a laptop/PC. I want to connect from cloud host to my mobile.

    • @RaghavPal
      @RaghavPal  Před 3 lety +1

      I will check on this

    • @mobistarc1872
      @mobistarc1872 Před 3 lety

      @@RaghavPal one solution I found was to ssh into remote host from my mobile terminal and then do port forwarding. I don't have full clarity on that as I haven't been able to implement. Maybe if you could also research on these lines and make a video it will be great.