Pyautogui clicks but it wont move the mouse

Question:

Pyautogui wont move the mouse but it will click just fine. I have tried adding the Terminal & python to permissions for taking over the computer, I have tried the drag options and setting coordinates manual. Nothing seems to work, its very frustrating. I’m on a new apple m1 chip, I doubt that is doing it but I thought I would mention it. Any help would be awesome!

def traffic(self):
    time.sleep(0.5)
    traffic = pyautogui.locateOnScreen('./Traffic.png', confidence=0.9)
    pyautogui.moveTo(traffic, duration=1)
    time.sleep(0.8)
    pyautogui.click(clicks=2, interval=0.5)
Asked By: Aaron Cloud

||

Answers:

The reason it does not move is because Traffic.png is not found, which returns None, which makes the mouse not move anywhere. To make sure the computer finds it, do a little print(traffic) after the locateOnScreen(). To increase the likelihood of finding the image, try setting it to grayscale and lowering the confidence value.

Answered By: The Laggy Tablet

I had the same problem as you, all you need to do is run python as administrator, like this comment if you find it helpful

Answered By: Duy Nhut Bui
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.