pyautogui 不点击特定按钮

问题描述 投票:0回答:0

我想使用仿真软件 bluestacks 5 自动化 Android 游戏。

  1. [x] 检测图像
  2. [x] 将鼠标移动到图像位置
  3. [-] 点击图片

但是第 3 步在 bluestacks 中不起作用...(未单击按钮)

我在 Windows 桌面开始按钮上测试了我的代码,然后开始按钮被点击了...

import pyautogui
import time

buttonBack = pyautogui.locateCenterOnScreen('button_back.png', confidence=0.7)

if buttonBack != None:
    print('back image:', buttonBack)
    pyautogui.moveTo(buttonBack)
    time.sleep(1)
    pyautogui.click(buttonBack) 
else:
    print('BACKBUTTON - NOPE')
python python-3.x automation pyautogui
© www.soinside.com 2019 - 2024. All rights reserved.