Monkeyrunner抛出“ ShellCommandUnresponsiveException” -可以解决吗? [英] Monkeyrunner throwing "ShellCommandUnrespo​nsiveException" - any work around?

查看:264
本文介绍了Monkeyrunner抛出“ ShellCommandUnresponsiveException” -可以解决吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Monkeyrunner脚本中的 device.shell('ping -c 2 192.168.1.1')中遇到了一些问题。
抛出

I am facing some issues in device.shell('ping -c 2 192.168.1.1') inside a monkeyrunner script. Its throwing

ShellCommandUnrespo‌​nsiveException 
[main] [com.android.chimpchat.adb.AdbChimpDevice]com.android.ddmlib.ShellCommandUnrespo‌​nsiveException 





while (count<1000) :
device.shell('dmesg -c')
print '****swithing OFF wifi in loop NO-',count
device.touch(400,155,MonkeyDevice.DOWN_AND_UP)
time.sleep(10)
print '****switching ON wifi in loop NO-',count
device.touch(400,155,MonkeyDevice.DOWN_AND_UP)
time.sleep(25)
fd=open('pingstats.txt','a+b')
fd.write('***Loop-%i \n************\n%s\n****************\n' % (int(count),ping))
ping = device.shell('ping -c 2 192.168.1.1')
status=re.search('unreachable',ping)
if status:
    dmesg=device.shell('dmesg')
    fd.write(logcat)
fd.close()
count = count + 1

请参见上面的脚本。我该如何解决?

Please see above script. How can I fix this?

推荐答案

只需添加 -t 即可。下面的示例非常完美!

Just add -t . An example below works perfectly !

device.shell('pm enable packageName -t 15')

这篇关于Monkeyrunner抛出“ ShellCommandUnresponsiveException” -可以解决吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆