UIAutomatorViewer is not working. Error obtaining UI Hiearchy. Unexpected error while obtaining UI Hiearchy - appium

I have stoppped appium server and then I tried to capture object through UIAutomatorViewer, but still it throws the error as "Unexpected error while obtaining UI Hierarchy". I have tried the following options.
Stop Appium server in the background.
Disconnected mobile device & connect it back.
3.close the uiautomatorviewer.bat file & restart it again.
Restarted the device
a. Turn on USB DEBUGGING
b. Enable view attribute inspection
c. Select the debug app option and choose io.appium.uiautomator2.server
adb devices to recognise my device.
I have exit and restarted uiautomatorviewer
After tried all the above options, still I get the same error.
Please help to get this issue resolved.
UIAutomatorviewer Error

Related

Build successful but unable to run on iOS simulator

I am making a demo of cordova app. The console log is showing me build successful but after sometime it shows this error and run fails :
2016-07-30 09:34:47.609 instruments[9268:1431174] WebKit Threading
Violation - initial use of WebKit from a secondary thread. Instruments
Usage Error: Unknown device specified:
"B7257830-92A2-4C85-A4BA-342D7237F9A8"
Known Devices:
test's iPhone (8.4.1) [7fdfcc5aaeb179fdb53a86343ba18796a1825bc4]
The error is to replace UDID with known devices but I am unable find the file where it is mentioned.
Please share the path of file or file name or anything related to this error. Thanks in advance.
I solved this error simply following two steps.
Step 1: Go to Run Options and select Run Configuration as image shown below.
Step 2 : Now a window will open as shown below & select your device from simulator list.

calabash-ios physical device test, app starts but crashes

Running calabash-ios cucumber for simple iPhone app. Simulator is working perfectly. When trying on physical device, app loads, crashes, then loads again, and crashes again, on a loop.
Error message:
Unable to start. Make sure you've set APP_BUNDLE_PATH to a build supported by this simulator version
Calabash::Cucumber::Launcher::StartError: Time out waiting for UIAutomation run-loop Error while writing to fifo. RunLoop::Fifo::NoReaderConfiguredError.
Logfile /var/folders/9s/yttj4cz93m98hqs6bfw2x8xr0000gn/T/run_loop20150522-12657-dr3m49/run_loop.out
2015-05-22 19:58:11 +0000 Fail: An error occurred while trying to run the script.
Instruments Trace Complete (Duration : 2.594758s; Output : /var/folders/9s/yttj4cz93m98hqs6bfw2x8xr0000gn/T/run_loop20150522-12657-dr3m49/trace.trace)
to run the script. UIAScriptAgentSignaledException
(Calabash::Cucumber::Launcher::StartError)
/Library/Ruby/Gems/2.0.0/gems/calabash-cucumber-0.14.3/lib/calabash-cucumber/launcher.rb:766:in `new_run_loop'
/Library/Ruby/Gems/2.0.0/gems/calabash-cucumber-0.14.3/lib/calabash-cucumber/launcher.rb:631:in `relaunch'
Steps:
loaded app-cal on device
ran in command-line using:
$ DEVICE_TARGET=udid BUNDLE_ID=com.company.app DEVICE_ENDPOINT=http://ip:37265
Error while writing to fifo. RunLoop::Fifo::NoReaderConfiguredError
The probably cause of this is that the device is not enabled for UIAutomation. The device must be enabled for development. A device is enabled for development if it appears in Xcode's Device's window (Shift + Command +2) and you must enable on-device testing manually by visiting the device's Settings.app > Developer tab.
If you have recently upgraded the iOS version we recommend that you check the UIAutomation settings again and perform a restart. Often, after an upgrade, Xcode cannot download debugging information from the device. Look at Xcode's Device's window. The device must appear without any warnings.
Sometimes devices get into a bad state and Xcode cannot communicate with it. We recommend trying to interact with the device with Apple's Instruments to clear this bad state.
All this information and more can be found on the Calabash iOS Hot Topics page. https://github.com/calabash/calabash-ios/wiki/Hot-Topics#6-errnoeintr-interrupted-system-call

WL.Client.login() then nsurlerrordomain error 1012

Worklight 6.2 building a hybrid application targeting iPad - we get the symptoms described below in the xCode Simulator irrespective of exactly which target device we select.
The application currently attempts a call to
WL.Client.login()
from within wlCommoninit()
Our target server is a full WL Server running on a Liberty instance on a remote machine, we use HTTPS and a specified IP Address
https://w.x.y.z:443/worklight
We have adjusted the Deploy Target and rebuilt the app before running XCode.
The WL.Client.login() error callback fires and we see log messages indicating that we are attempting to hit the correct URL. We also see this error message
NSURLErrorDomain error -1012
We do have a complex network setup, with a firewall between the iOS simulator and the server and yet if we run up Safari on the simulated device we can correctly access the URL.
Questions:
Does that NSURLErrorDomain reflect the cause of the failure? Or is it just part of the error processing?
Any suggestions for further diagnosis?
Further investigation indicated that we did have the wrong URL configured. It seems that
NSURLErrorDomain error -1012
is not in itself an indicator of the problem. Rather, the error follows from the failure to reach the specified host. Conclusion: study the logs prior top that NSURLErrorDomain message.

Error in using UIAutomatorviewer for testing Android app in Appium

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. 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:
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.
Can someone please tell how to fix the issue so that I can inspect elements?
Is there any other way I can inspect element in the app apart from using UIAutomator viewer?
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.
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.
Make sure everything on your screen is static. And flashing input cursor is also not allowed. Any painting actions will stop uiautomator from dumping current UI.
You can test by using following adb command:
adb shell uiautomator dump /data/local/tmp/uidump.xml
if the message ERROR: could not get idle state. appears, you are suffering from this issue.
See lines 87 & 101 of DumpCommand:
try {
...
uiAutomation.waitForIdle(1000, 1000 * 10);
...
} catch (TimeoutException re) {
System.err.println("ERROR: could not get idle state.");
return;
}
Easiest solution..
Restart the device. Restart uiautomatorviewer.
Worked like a charm for me .... :P
Stop the Appium Server. Then try again. It works.
I had the same problem because I used "adbd insecure". So I just disabled "adbd insecure", and reload uiautomatorviewer, everything is OK.
In case of rooted devices: Enable the root access in developer options for adb. Restart adb as root
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.
Answer to your question #2
You can inspect Android app directly from your real Android device.
You need to:
Connect Android device to your computer/laptop
Go to Android device Settings -> Enable Developer Options and Android debbuging
Please see here:
Start the app you wish to inspect in your Android device
Open up the Chrome browser on your computer/laptop and do a right click -> More Tools -> Inspect devices -> Click on your device -> (Click on Android device OK to authorize) -> Click Inspect
Please see here:
That's it. Hope it helps!
I got also the same issue (Also if Appium Server was not running). After switch, OFF / ON USB-Debugging was working for me.
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
The one that works is in this path:
Android/Sdk/tools/bin/uiautomatorviewer
Paste this in your terminal and it will run automator that works
we have to use device which has API level morethan 17 or jelly bean
Way to bypass the ERROR:
could not get idle state.
By using uiautomator to get uix and screenshot.
public class DeviceMethods extends UiAutomatorTestCase {
public void dump(){
try {
getUiDevice().dumpWindowHierarchy("window_dump.uix") ;
getUiDevice().takeScreenshot(new File("/data/local/tmp/window_dump.png"));
} catch (Exception e) {
}
}
you need to create the uiautomator jar and push it to /data/local/tmp
use this tutorial on how to use uiautomator
after you get the files just open them in uiautomatorviewer
What worked for me:
stop appium
open an emulator device (tested with Android 7.1.1)
go into settings > developer options > Enable view attribute inspection
open a shell on the computer, cmd or terminal depending on your OS
enter the following commands:
adb shell
su
cd /data
cd /local
chmod 777 tmp
start uiautomatorviewer
take an xml screenshot
"su chmod 777 /data/local/tmp" didnt work for me so I drilled down and it worked. I assume that you have to do this in an emulator and not a physical device unless the device is rooted. ¯ \ _ (ツ)_/¯
Lotsa Luck!
This happens because adb is using port and it's blocked by appium server.
I have found out best solution for this
Kill the adb.exe from taskbar processes and try launching uiautomatorviewer again
Check whether you have enabled these under "developer options" in the phone.
Verify apps via USB
View attribute inspection
USB debugging
1) stop appium Server
2) open an emulator device
3) go into settings > developer options > Enable view attribute inspection
4) developer options in invisible? Go into settings > Tap on About device/phone > Scroll down till the last option(Build number) > Continuously Tap on "Build number" for 7 times > you should get an Toast message "You're a developer" > come back from that screen > Go back into settings > Now you should see developer options Tap on it > Enable view attribute inspection
5) You should no more get this error message
Why don't you use appium inspector instead? You can download it and follow instructions from here
try switching Off and then ON the USB debugging option.. this work for me

Swift Playground and Simulator Error (ipc/mig) server died, Unable to boot the iOS Simulator

When I try to do anything in Playground, this pops up before I even finish typing a word.
Error running playground.
Failed to launch iOS stub for playground: The operation couldn’t be completed. (Mach error -308 - (ipc/mig) server died).
and when I just try to run IOS Simulator I get the following error
Unable to boot the iOS Simulator.
oh and this error just popped up
An error was encountered while running (Domain = DTiPhoneSimulatorErrorDomain, Code = 2)
I tried rebooting, I closed out and opened again, I deselected file and reselected. Just keeps happening. Anyone have a solution?
Your firewall is blocking the debugger, you need to allow it to connect:
TCP out 127.0.0.1:63748
Or allow the debugserver process open access (whichever you, or your firewall, prefer(s)).
Upon enabling it, and restarting Xcode everything should work like a charm.
Note/Update:
If you're having trouble finding, or allowing, the debugserver simply try, temporarily, disabling your firewall and restart xcode. Does the playground work? Oh, and don't forget to make sure you've got the assistant view open and the output box showing.
Currently the Xcode 6 beta needs to reside in \Applications for the playground and simulator to work. After you move it there you need to reboot.
This error popped up for me when I closed the simulator before Xcode finished attaching my application to it. Opening the simulator and running the app again solved this problem.

Resources