You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
..\conftest.py:9: in test_setup
d.demo.close_all()
......\lib\demo.py:412: in close_all
self.device.press.recent()
........\venv\lib\site-packages\uiautomator_init_.py:74: in call
return self.func(*args, **kwargs)
........\venv\lib\site-packages\uiautomator_init_.py:787: in press
return self.server.jsonrpc.pressKey(str(key))
........\venv\lib\site-packages\uiautomator_init.py:421: in wrapper
return method_obj(*args, **kwargs)
........\venv\lib\site-packages\uiautomator_init.py:132: in call
"%s: %s" % (jsonresult["error"]["data"]["exceptionTypeName"], jsonresult["error"]["message"])
E TypeError: string indices must be integers
The text was updated successfully, but these errors were encountered:
It looks like the error is happening because the code is trying to treat a string as if it were a dictionary. Specifically, when it tries to access jsonresult["error"]["data"]["exceptionTypeName"], it's expecting jsonresult["error"]["data"] to be a dictionary, but it's actually a string. That's why we're getting the "string indices must be integers" error. We need to add a check to make sure we're dealing with a dictionary before trying to access keys like that.
Here's the code to check if jsonresult["error"]["data"] is a dictionary before accessing its keys:
..\conftest.py:9: in test_setup
d.demo.close_all()
......\lib\demo.py:412: in close_all
self.device.press.recent()
........\venv\lib\site-packages\uiautomator_init_.py:74: in call
return self.func(*args, **kwargs)
........\venv\lib\site-packages\uiautomator_init_.py:787: in press
return self.server.jsonrpc.pressKey(str(key))
........\venv\lib\site-packages\uiautomator_init.py:421: in wrapper
return method_obj(*args, **kwargs)
........\venv\lib\site-packages\uiautomator_init.py:132: in call
"%s: %s" % (jsonresult["error"]["data"]["exceptionTypeName"], jsonresult["error"]["message"])
E TypeError: string indices must be integers
The text was updated successfully, but these errors were encountered: