简体   繁体   中英

pyautogui.click is not clicking after calling subprocess.Popen

I'm trying to automate launching of a program on Windows. I've tried giving the path to subprocess.Popen , however I get the UAC pop up, so to work around I created a task on task scheduler and targeted the shortcut.

The problem I'm facing is that once I run the below script, the program opens nicely, pyautogui is able to move the mouse to the buttons on the UI but the click does not seem to be registering.

I've also tried openGI.terminiate() to close the subprocess and return control to the script but what happens is that the script ends after opening the program and the atutomation does not happen.

import subprocess
import pyautogui
import time

openGI = subprocess.Popen('C:\Windows\System32\schtasks.exe /run /TN \GI')
time.sleep(3)
pyautogui.click((1671, 832))
time.sleep(3)
pyautogui.click((1661, 961)) #click launch
time.sleep(3)
pyautogui.click((1236, 829)) #click start
time.sleep(3)
pyautogui.click((1287, 829)) #click to begin

尝试在需要启动程序的地方使用pyautogui.doubleClick()而不是pyautogui.click()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM