简体   繁体   English

Monkeyrunner抛出“ ShellCommandUnresponsiveException”-有什么解决方法?

[英]Monkeyrunner throwing “ShellCommandUnrespo​nsiveException” - any work around?

I am facing some issues in device.shell('ping -c 2 192.168.1.1') inside a monkeyrunner script. 我在device.shell('ping -c 2 192.168.1.1')脚本中的device.shell('ping -c 2 192.168.1.1')device.shell('ping -c 2 192.168.1.1')一些问题。 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? 我怎样才能解决这个问题?

Just add -t . 只需添加-t An example below works perfectly ! 下面的例子很完美!

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

your ping waits to long 您的ping等待很长时间

add a -t 添加-t

start with -t 1 以-t 1开头

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM