微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

AttributeError: 模块“pyautogui”没有属性“getWindowsWithTitle”

如何解决AttributeError: 模块“pyautogui”没有属性“getWindowsWithTitle”

我正在编写一个与浏览器交互的机器人(不要说服我为 Selenium 或键盘等重写),它给了我一个错误。附近没有名称pyautogui文件,我尝试将其命名为 main 和 python v3.8,3.9。在每种情况下都收到此错误。 macOS

/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/rubicon/objc/ctypes_patch.py:21: UserWarning: rubicon.objc.ctypes_patch has only been tested with Python 3.4 through 3.8. You are using Python 3.9.4. Most likely things will work properly,but you may experience crashes if Python's internals have changed significantly.
  warnings.warn(
Traceback (most recent call last):
  File "/Users/alina/PycharmProjects/ABOBA/main_miner_alienworlds.py",line 183,in <module>
    for i in pyautogui.getwindowsWithTitle('##### #######'):
AttributeError: module 'pyautogui' has no attribute 'getwindowsWithTitle'
import pyautogui

…
for j in pyautogui.getwindowsWithTitle('##### #######'):
    do something

pyautogui 与 pip3 一起安装

解决方法

不幸的是,从 0.9.53 版本开始,pyautogui 的窗口功能仅适用于窗口,请参阅以下来源的 https://i.stack.imgur.com/HKtcC.png:- https://automatetheboringstuff.com/2e/chapter20/

,

您使用了错误的模块!

https://pypi.org/project/PyGetWindow/ 是包含 getWindowsWithTitle

的模块

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。