xiaocong / uiautomator

Python wrapper of Android uiautomator test tool.
MIT License
2.02k stars 638 forks source link

Uiautomator doesn't work 0.1.32 #68

Open ZeroInputCtrl opened 9 years ago

ZeroInputCtrl commented 9 years ago

Continued from issue #57. When i test the jsonrpc server (in the faq) i get some feedback and then the script freezes. I check this because whenever I try to perform and action on an object (e.g Click, exists) python freezes for a long time then i get an error about the RPC server not running. I have reinstalled python and all the plug-ins from cratch but that didn't seem to fix the issue. I will be trying this on another machine as well to see if I have the same issue. Logcat is here https://www.dropbox.com/s/ftc7ufo4vgjm0es/new_log.log

C:\Console2>adb shell uiautomator runtest bundle.jar uiautomator-stub.jar -c com.github.uiautomatorstub.Stub
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
INSTRUMENTATION_STATUS: class=com.github.uiautomatorstub.Stub
INSTRUMENTATION_STATUS: stream=
com.github.uiautomatorstub.Stub:
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: test=testUIAutomatorStub
INSTRUMENTATION_STATUS_CODE: 1
ZeroInputCtrl commented 9 years ago

One device is Galaxy S4; SAMSUNG-SGH-1337; Android 4.3 The other is Galaxy S5; SAMGUNG-SM-G900A; Android 4.4.2

ZeroInputCtrl commented 9 years ago

I rolled back the version to 0.1.31 and everything works again.

ZeroInputCtrl commented 9 years ago

Does any of this help?

xiaocong commented 9 years ago

Yes, it do help me. I am trying to find different devices and then reproduce the issue. Thank @DeathCorps69

xiaocong commented 9 years ago

Hi @DeathCorps69,

Sorry for my late response. I have tried on all device I could get, and also on Android L emulator, but I could not reproduce the issue you reported, and also I could not find any clue from your attached log.

On V0.1.32 I updates jar files to resolve issue on Android L. I assume it was caused by cached previous jar files. Could you please do me a favor to clear all caches on /data/local/tmp/dalvik-cache or /data/dalvik-cache or /dalvik-cache, and then re-try it?

Thank you in advance.

ZeroInputCtrl commented 9 years ago

So, navigating to the /data folder requires root (which rooting is not an option), and the phone i'm using doesn't have /dalvik-chache either.

xiaocong commented 9 years ago

Please try cmd cd /data/local/tmp.

ZeroInputCtrl commented 9 years ago

Yea that worked, and now 0.1.32 is working ^.^ thanks. Might be good for the FAQ at the bottom

ZeroInputCtrl commented 9 years ago

I guess this issue isn't resolved. After a half-day of using the latest version i ran into the same issue. This time clearing the Dalvik cache didn't fix it... I tried to see if jsonprc was up.

I think the Parse error below has to do with the jsonrpc server freezing when I try starting it just like before

C:\>adb shell uiautomator runtest bundle.jar uiautomator-stub.jar -c com.github.uiautomatorstub.Stub
INSTRUMENTATION_STATUS: current=1
INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
INSTRUMENTATION_STATUS: class=com.github.uiautomatorstub.Stub
INSTRUMENTATION_STATUS: stream=
com.github.uiautomatorstub.Stub:
INSTRUMENTATION_STATUS: numtests=1
INSTRUMENTATION_STATUS: test=testUIAutomatorStub
INSTRUMENTATION_STATUS_CODE: 1
C:\>adb forward tcp:9008 tcp:9008

C:\>curl -d '{"jsonrpc":"2.0","method":"deviceInfo","id":1}' localhost:9008/jsonrpc/0
{"jsonrpc":"jsonrpc","id":"null","error":{"code":-32700,"message":"Parse error"}}
ZeroInputCtrl commented 9 years ago

How long it it supposed to take to launch the runtest on the bundle/uiautomator-stub. I'm seeing it hang when i run it even on 0.1.31 BUT uiautomator seems to be working just fine with 0.1.31...

ZeroInputCtrl commented 9 years ago

I switch back to 0.1.32 to see if it would 'magically' work, and it did for a day or two, then I couldn't use it again. Same parse error as before. Also while debugging i noticed that it was going in an infinite loop as well.

xiaocong commented 9 years ago

Coule you please share me a simple sample code which can reproduce the issue? Thanks in advance.