0

我正在使用 AndroidViewClient 测试各种智能手机。为了防止连接错误,我使用了连接选项(kwargs1,kwargs2),如下所示。

from com.dtmilano.android.viewclient import *
from com.dtmilano.android.adb.adbclient import *

kwargs1 = {'ignoresecuredevice': True}
kwargs2 = {'startviewserver': False, 'autodump': False}
vc = ViewClient(*ViewClient.connectToDeviceOrExit(**kwargs1), **kwargs2)
device, serialno = vc.device, vc.serialno

adb = AdbClient(serialno=serialno)
MODEL = adb.getProperty('ro.product.model')
print 'MODEL :', MODEL

因此,连接错误消失了。但是某些具有特殊序列号的手机(例如“LG-F160S-e0a852”、“EF47S01111100117300”、...)出现序列号错误。

Traceback (most recent call last):
  File "D:\$Project\Eclipse\_Python\AutoTest\01_get_property4.py", line 43, in <module>
    adb = AdbClient(serialno=serialno)
  File "D:\$Project\Eclipse\AndroidViewClient-master\src\com\dtmilano\android\adb\adbclient.py", line 108, in __init__
    self.__setTransport()
  File "D:\$Project\Eclipse\AndroidViewClient-master\src\com\dtmilano\android\adb\adbclient.py", line 251, in __setTransport
    raise RuntimeError("ERROR: couldn't find device that matches '%s'" % self.serialno)
RuntimeError: ERROR: couldn't find device that matches '8b1ac56e'

如何获得正确的序列号或防止此错误?

4

0 回答 0