How to get pyautogui's click working on mac?

前端 未结 4 1202
盖世英雄少女心
盖世英雄少女心 2021-01-26 20:16

pyautogui\'s click method\'s issue: I am running the script from Spyder, if I click anything on Spyder\'s window the click works fine.

If I execute a script to open Outl

相关标签:
4条回答
  • 2021-01-26 20:33

    I was also facing same issue, Here is what I tried :

    Just add one more line pyautogui.dragTo() to focus on that particular selected area:

    pyautogui.moveTo(990,28)
    pyautogui.dragTo() 
    pyautogui.click()
    
    0 讨论(0)
  • 2021-01-26 20:38

    I just found out that in mac setting, I did not check the tip in front of PyCharm in privacy setting. After doing that, my pyautogui.click() function works.

    0 讨论(0)
  • 2021-01-26 20:41

    To anyone who might stumble into the same issue on a Mac, I was able to get it working by using a workaround that is using the pynput library.

    Code:

    import pyautogui
    from pynput.mouse import Button, Controller
    
    mouse = Controller()
    pyautogui.moveTo(x,y)
    mouse.click(Button.left)
    
    0 讨论(0)
  • 2021-01-26 20:57

    OS X Mojave, the following works for me:

        pyautogui.moveTo(pos)
        pyautogui.dragTo(button='left')
    

    pyautogui.click() throws an attribute error but pyautogui.dragTo() works instead.

    0 讨论(0)
提交回复
热议问题