having trouble clicking in program - pyautogui

孤者浪人 提交于 2019-12-24 06:33:12

问题


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.

Here's the code

import pyautogui
pyautogui.doubleClick(x=300, y=300)

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)

What the heck do I do?


回答1:


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




回答2:


Try giving the interval argument

pyautogui.doubleClick(x=300, y=300, interval=0.25)



来源:https://stackoverflow.com/questions/40983604/having-trouble-clicking-in-program-pyautogui

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!