wxauto
wxauto copied to clipboard
用微信昵称发消息会报错。
微信版本:3.9.11.17 wxauto版本:3.9.11.17.4 cpu:i9-14900KF 系统:Windows 10 专业版
错误描述: 在sendMsg的时候如果用用户备注作为who来调用sendMsg,能正常发送消息,但如果用用户昵称作为who来调用sendMsg,会发生报错,如下:
代码:
import wxauto
wx = wxauto.WeChat()
wx.SendMsg(who="filehelper", msg="你好")
报错信息:
初始化成功,获取到已登录窗口:山河故人
Traceback (most recent call last):
File "d:\anaconda\envs\wxauto\Lib\runpy.py", line 198, in _run_module_as_main
return _run_code(code, main_globals, None,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "d:\anaconda\envs\wxauto\Lib\runpy.py", line 88, in _run_code
exec(code, run_globals)
File "c:\Users\RTX-AI\.vscode\extensions\ms-python.debugpy-2024.10.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy\__main__.py", line 39, in <module>
cli.main()
File "c:\Users\RTX-AI\.vscode\extensions\ms-python.debugpy-2024.10.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 430, in main
run()
File "c:\Users\RTX-AI\.vscode\extensions\ms-python.debugpy-2024.10.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher/../..\debugpy/..\debugpy\server\cli.py", line 284, in run_file
runpy.run_path(target, run_name="__main__")
File "c:\Users\RTX-AI\.vscode\extensions\ms-python.debugpy-2024.10.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 321, in run_path
return _run_module_code(code, init_globals, run_name,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\Users\RTX-AI\.vscode\extensions\ms-python.debugpy-2024.10.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 135, in _run_module_code
_run_code(code, mod_globals, init_globals,
File "c:\Users\RTX-AI\.vscode\extensions\ms-python.debugpy-2024.10.0-win32-x64\bundled\libs\debugpy\_vendored\pydevd\_pydevd_bundle\pydevd_runpy.py", line 124, in _run_code
exec(code, run_globals)
File "D:\repo\wxauto_demo\test.py", line 5, in <module>
wx.SendMsg(who="filehelper", msg="你好")
File "d:\anaconda\envs\wxauto\Lib\site-packages\wxauto\wxauto.py", line 404, in SendMsg
editbox.SendKeys('{Ctrl}a', waitTime=0)
File "d:\anaconda\envs\wxauto\Lib\site-packages\wxauto\uiautomation.py", line 6327, in SendKeys
self.SetFocus()
File "d:\anaconda\envs\wxauto\Lib\site-packages\wxauto\uiautomation.py", line 5777, in SetFocus
return self.Element.SetFocus() == S_OK
^^^^^^^^^^^^
File "d:\anaconda\envs\wxauto\Lib\site-packages\wxauto\uiautomation.py", line 5788, in Element
self.Refind(maxSearchSeconds=TIME_OUT_SECOND, searchIntervalSeconds=self.searchInterval)
File "d:\anaconda\envs\wxauto\Lib\site-packages\wxauto\uiautomation.py", line 6087, in Refind
raise LookupError('Find Control Timeout: ' + self.GetSearchPropertiesStr())
LookupError: Find Control Timeout: {Name: 'filehelper', ControlType: EditControl}