Error in using UIAutomatorviewer for testing Andro

2019-01-18 03:45发布

I have to automate an Android application, I am doing the same through Appium. The problem I am facing is after launching the Appium server, the app is getting installed in the emulator 4.4.2 and to inspect the element I am using UIAutomatorviewer which comes default with SDK. But while inspecting the element of the app, I am getting the error![enter image description here][1]

Error obtaining UI hierarchy
Reason:Error while obtaining UI hierarchy XML file.com.android.ddmlb.SynchException.Remote object doesn't exist.

I tried to find the solution so that I can inspect the element so that I can script, but in vain.

  1. Can someone please tell how to fix the issue so that I can inspect elements?
  2. Is there any other way I can inspect element in the app apart from using UIAutomator viewer?

19条回答
欢心
2楼-- · 2019-01-18 04:24

I got it resolved

I closed the Appium Server running on my machine and opened it again. Later open uiautomater, and it worked for me

查看更多
▲ chillily
3楼-- · 2019-01-18 04:25

I got also the same issue (Also if Appium Server was not running). After switch, OFF / ON USB-Debugging was working for me.

查看更多
手持菜刀,她持情操
4楼-- · 2019-01-18 04:27

I have spent over a week to resolve this issue. When you connect your device and using ASM 3.0, when screen is projected open the UIAutomator to capture the current android screen. Without Appium it should capture. For use Android Studio instead of android sdk. Uninstall and reinstall Android Studio. It is working perfect for me now.

查看更多
淡お忘
5楼-- · 2019-01-18 04:28

Check whether you have enabled these under "developer options" in the phone.

  1. Verify apps via USB
  2. View attribute inspection
  3. USB debugging
查看更多
别忘想泡老子
6楼-- · 2019-01-18 04:29

I fixed the same issue by using following methods.

(1) Connect your Android device to your development machines;

(2) Go to command line in terminal or DOS command line for Windows;

(3) Using "adb shell" into your Android devices;

(4) Change the user to root by input "su root" in command line;

(5) Change the access right to /data/local/tmp by input "chmod 777 /data/local/tmp";

(6) Go back to uiautomatorviewer and do screen shot again, the error should be gone;

I guess there are some file can't be access if it doesn't own right in /data/local/tmp.

查看更多
迷人小祖宗
7楼-- · 2019-01-18 04:31

After my tryst with the uiautomator viewer i came to know that we get the error only when:

appium server is running and we try to capture the screenshot using uiautomatorviewer.

So, whenever you want to use uiautomatorviewer make sure that server is in stopped state.

查看更多
登录 后发表回答