1

我在device.shell('ping -c 2 192.168.1.1')monkeyrunner脚本中遇到了一些问题。它的投掷

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

请参阅上面的脚本。我怎样才能解决这个问题?

4

2 回答 2

0

您的 ping 等待很长时间

添加 -t

以 -t 1 开头

于 2012-03-15T13:57:11.803 回答
0

只需添加-t. 下面的一个例子完美地工作!

device.shell('pm enable packageName -t 15')
于 2013-07-19T09:58:00.980 回答