最近在用pyautogui写自动化的脚本时,用pyautogui.locateonscreen("shell.PNG")函数来判断机器成功进入EFIshell会一直返回None。

且shell.PNG在当前屏幕置顶可见,但就是抓不到。

解决方法:安装opencv,并在locateOnScreen添加confidence参数

参考:https://stackoverflow.com/questions/43702511/why-pyautogui-locateonscreen-only-returns-none

pip  install opencv-python --timeout 10000

 

shell.PNG

pyautogui.locateonscreen()一直返回none

 

 成功安装opencv后,可以抓到图片的坐标.

import pyautogui
import cv2
res=pyautogui.locateOnScreen("shell.PNG",confidence=0.5)
print(res)
Box(left=1044, top=696, width=53, height=20)

 

pyautogui.locateonscreen()一直返回none

 

  如何将窗口永久置顶见:https://www.cnblogs.com/pfeiliu/p/13795698.html

 

相关文章:

  • 2021-11-11
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2021-06-21
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-08-03
  • 2021-08-29
  • 2022-12-23
  • 2022-01-06
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案