-->

having trouble clicking in program - pyautogui

2019-08-07 13:59发布

问题:

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:

Try giving the interval argument

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



回答2:

If the application in running as administrator and pyautogui script running with administrators, then control will not work.pyautogui script should be running as administrator to control it