I'm testing various smartphones using AndroidViewClient. To prevent connection errors, I used connection options(kwargs1, kwargs2) as follows.
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
So, connection errors disappeared. But some phones with special serial number(such as 'LG-F160S-e0a852', 'EF47S01111100117300', ...) raised following serialno error.
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'
How can I get correct serialno or prevent this error?