我正在尝试使用python和pyautogui使软件安装自动化,但是pyautogui不要单击,不要按,只是找到位置:
import pyautogui
import time
import pyperclip
for window in pyautogui.getWindows():
pyautogui.getWindow(window).minimize()
##Open the directory where we can find the .exe
pyautogui.hotkey("win","r")
pyautogui.press("\\")
pyautogui.press("\\")
pyperclip.copy("ts1/publico/Meus Documentos/Equipes Qualidade/Automação/Aplicativos/Folha/Sefip 8.4")
pyautogui.hotkey("ctrl","v")
pyautogui.press("enter")
##Take the .exe position and click on it.
executavel = None
while executavel is None:
executavel = pyautogui.locateOnScreen("executavel.png", grayscale=False)
executalvelX, executavelY = pyautogui.center(executavel)
pyautogui.click(executalvelX, executavelY, clicks=2)
##The program opens
##Find the button "YES", and click on it(The Script find the button, but pyautogui.click(), pyautogui.moveTo(), pyautogui.press() don't work!)
botaoSim = None
while botaoSim is None:
botaoSim = pyautogui.locateOnScreen("botaosim.png", grayscale=False)
botaoSimX, botaoSimY = pyautogui.center(botaoSim)
for _ in range(4):
next1 = None
while next1 is None:
next1 = pyautogui.locateOnScreen("next.png", grayscale=False)
next1X, next1Y = pyautogui.center(next1)
pyautogui.click(next1X, next1Y)
为什么这些功能不起作用?