问题描述
我正在尝试使用 pyautogui 单击程序窗口.
I'm trying to click into a program window using pyautogui.
在程序窗口中单击时,在我想按的按钮上,鼠标光标旁边会出现一个加载图标,好像它在思考,但实际上从未单击过.但是,它确实会移动到我提供的光标位置.
When clicking in the program window, on a button I wish to press, a loading icon appears next to the mouse cursor as if it is thinking, and it never actually clicks. It does, however, move to the cursor location that I provide.
这是代码
import pyautogui
pyautogui.doubleClick(x=300, y=300)
我打开 Excel 以查看它是否会点击进入,并且确实如此,但前提是我将代码运行为:
I opened Excel to see if it will click into that, and it does, but only if I run the code as:
import pyautogui
pyautogui.doubleClick(x=300, y=300)
pyautogui.doubleClick(x=300, y=300)
我到底在做什么?
推荐答案
如果以管理员身份运行的应用程序和 pyautogui 脚本不是以管理员身份运行,那么控制将不起作用.pyautogui 脚本也应该以管理员身份运行来控制它
If the application in running as administrator and pyautogui script is not running as administrators, then control will not work. pyautogui script should also run as administrator to control it
这篇关于单击程序时遇到问题 - pyautogui的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!