自动化测试PyAutoGUI 遇到的坑

API文档:https://pyautogui.readthedocs.org

中文文档:https://muxuezi.github.io/posts/doc-pyautogui.html

源码:https://github.com/asweigart/pyautogui

使用方法API文档中介绍的比较详细,本文主要介绍安装和使用过程中遇到的错误。

1、pip install pyautogui,提示“UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2”

Using cached https://files.pythonhosted.org/packages/f1/54/740939161eb3471e8f7
75ce9b0fcac0e54c36bf63501e51f2cd7158f587d/PyGetWindow-0.0.3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in 
File "C:\Users\tedgame\AppData\Local\Temp\pip-install-tqy3ahwx\pygetwindow
\setup.py", line 11, in 
long_description = fh.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 905: ille
gal multibyte sequence

 

解决办法:pyautogui依赖的是pygetwindow==0.04,先pip install pygetwindow==0.0.1,再安装pyautogui

2、locateonscreen 函数无法添加confidence参数,提示TypeError: _locateAll_python() got an unexpected keyword argument 'confidence

解决办法:需要先安装opencv,方法

pip install opencv-python

 

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页