问题
I am facing some issues in device.shell('ping -c 2 192.168.1.1')
inside a monkeyrunner script.
Its throwing
ShellCommandUnresponsiveException
[main] [com.android.chimpchat.adb.AdbChimpDevice]com.android.ddmlib.ShellCommandUnresponsiveException
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?
回答1:
your ping waits to long
add a -t
start with -t 1
回答2:
Just add -t
. An example below works perfectly !
device.shell('pm enable packageName -t 15')
来源:https://stackoverflow.com/questions/9177645/monkeyrunner-throwing-shellcommandunresponsiveexception-any-work-around