asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.22k stars 1.24k forks source link

Running pyautogui command does not work on MacOS 12.0.1 #709

Open frozen6169 opened 2 years ago

frozen6169 commented 2 years ago

Steps to reproduce: 1) Installed pyautogui 0.9.53 using command pip3 install pyautogui via Mac Terminal 2) Run python3 3) Run the following: import pyautogui pyautogui.press('shift')

Outcome: 1) In the taskbar, a "bouncing" Python app icon appears and the command did not successfully execute.

Note: I did the same using jupyter notebook as well, with same results

jack-ylt commented 2 years ago

press 'shift' may no effect.

how about try: press 'a'

yezhengli-Mr9 commented 1 year ago

How to realize command on macos?

        driver = webdriver.Firefox()
    driver.get(URL)
    wait = WebDriverWait(driver, 200)
    time.sleep(5)
    # Press Ctrl+S to open the Save As dialog box
    pyautogui.hotkey('command', 's')
    '''
    pyautogui.keyDown('command')
    pyautogui.press('s')
    '''
    time.sleep(5)

    # Type the file path and press Enter to save the file
    # pyautogui.typewrite('downloads/')
    pyautogui.press('enter')
    time.sleep(5)

similar to https://github.com/JetBrains/jdk8u_jdk/issues/37 in java.