d(text='CHINA UNICOM').click()出现TypeError: string indices must be integers
最近在做android测试,用到uiautomator,使用d(text='CHINA UNICOM').click(),总是出现:
d(text='CHINA UNICOM').click() File "C:\Program Files\Python37\lib\site-packages\uiautomator\__init__.py", line 76, in __call__ return self.func(*args, **kwargs) File "C:\Program Files\Python37\lib\site-packages\uiautomator\__init__.py", line 971, in _click return self.jsonrpc.click(self.selector) File "C:\Program Files\Python37\lib\site-packages\uiautomator\__init__.py", line 438, in wrapper return _method_obj(*args, **kwargs) File "C:\Program Files\Python37\lib\site-packages\uiautomator\__init__.py", line 135, in __call__ "%s: %s" % (jsonresult["error"]["data"]["exceptionTypeName"], jsonresult["error"]["message"]) TypeError: string indices must be integers
WTF!!!
没找到能不能元素好好报个错误??
使用SDK工具uiautomatorviewer.bat截取数据查看元素的text名,发现是China Unicom,屏幕上显示的全部大写,元素为开头大写,改过之后可以正常运行
以前-好记性不如烂笔头
现在-好记性不如烂键盘