Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

用微信昵称发消息会报错。 #276

Open
JV-X opened this issue Sep 24, 2024 · 6 comments
Open

用微信昵称发消息会报错。 #276

JV-X opened this issue Sep 24, 2024 · 6 comments

Comments

@JV-X
Copy link

JV-X commented Sep 24, 2024

微信版本: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}
@Baile888
Copy link

我出现了同样的问题

@JV-X
Copy link
Author

JV-X commented Sep 30, 2024

commented

我已经把这个问题解决了,V我50,帮你解决 :D

@lucoo
Copy link

lucoo commented Oct 22, 2024

兄弟怎么解决的啊 @JV-X

@JV-X
Copy link
Author

JV-X commented Oct 24, 2024

兄弟怎么解决的啊 @JV-X

vx:xjv1195275315
v我50吃肯德基,我帮你解决:D

@lucoo
Copy link

lucoo commented Oct 25, 2024

兄弟怎么解决的啊 @JV-X

vx:xjv1195275315 v我50吃肯德基,我帮你解决:D

哈哈,我加你

@JV-X
Copy link
Author

JV-X commented Oct 29, 2024

兄弟怎么解决的啊 @JV-X

vx:xjv1195275315 v我50吃肯德基,我帮你解决:D

哈哈,我加你

没收到好友申请呢 >_<

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants