我心依依旧
这个作者很懒,什么都没留下…
展开
-
PC客户端自动化测试-用例组织运行
使用python单元测试框架unittest组织运行,自定用例加载及运行方法import osimport shutilimport timeimport unittestfrom PIL import ImageGrabfrom BeautifulReport import BeautifulReportfrom common.readconfig import project_dir, configOperatefrom common.utils import mkdir, clean_原创 2021-01-09 15:21:15 · 523 阅读 · 2 评论 -
PC客户端自动化测试-自定义截屏装饰器
pywinauto自带的截图方法capture_as_image不能实现一些图片特殊功能,比如图片加文字、时间戳水印,图片对比等功能,使用pillow自定义截图装饰器可实现传入特殊参数,图片加文字、时间戳水印,图片对比等功能。import osimport timeimport functoolsimport subprocessimport inspectimport sysimport shutilfrom common.readconfig import project_dir, co原创 2021-01-09 15:16:35 · 495 阅读 · 0 评论 -
PC客户端自动化测试-键盘鼠标操作
7、键盘操作from pywinauto.keyboard import send_keys按F5:send_key("{F5}")回车:send_key("{ENTER}")tab键:send_key("{VK_TAB}")退格:send_key("{VK_BACK}")发送文本:send_key(“gfdg”)注意发送命令要带{},不带{}为输入文本字符串下图弹框:除了使用pywinauto获取重量信息子窗口:app.window(title_re=‘重量信息’)外,还可以直接发送命令原创 2021-01-09 15:02:14 · 565 阅读 · 0 评论 -
PC客户端自动化测试-控件操作方法
6、常用控件操作方法6.1、输入框输入dlg_spec['edit1'].type_keys(r'01395465',with_spaces=False) #模拟键盘输入,添加文本,已有追加dlg_spec['edit2'].set_text(r'123456') # 模拟键盘输入,设置文本,已有清除6.2、菜单栏选择菜单dlg_spec2.menu_select(r'入库操作') #选择一级菜单menu_select 选择菜单 window.menu_select("帮助->关于记原创 2021-01-09 14:58:27 · 1148 阅读 · 2 评论 -
PC客户端自动化测试-等待
6 等待窗口或控件处在指定状态窗口控件,特别是按钮,有时点击会无效。因为控件不稳定,特别是刚打开页面时,所以需要增加等待稳定后再点击。wait()方法wait(wait_for, timeout=None, retry_interval=None)Wait for the window to be in a particular state/states.此方法对窗口和控件都适用。Parameters:wait_for –The state to wait for the window to原创 2021-01-09 14:51:28 · 893 阅读 · 0 评论 -
PC客户端自动化测试-窗口及控件定位
5 定位控件目录结构树获取,backend=‘uia’app.window(title=r’FLUX WMS V7.9’). print_control_identifiers(filename =r’a.txt’)5.1定位窗口dlg = app.Notepaddlg = app['Notepad']e.g.title:全名匹配title_re:正则匹配窗口名dlg = app.window(title="Page Setup")dlg = app.window(title_re=原创 2021-01-09 14:44:28 · 1664 阅读 · 0 评论 -
pywinauto current_depth> depth: TypeError: ‘>‘ not supported between instances of ‘int‘ and ‘str‘
代码如下:window.print_control_identifiers(filename)pywinauto打印窗口控件时报错:current_depth> depth: TypeError: ‘>’ not supported between instances of ‘int’ and ‘str’,经过排查发现,原来是传参错误,导致报错,直接传形参,结果传给了depth正确的格式:window.print_control_identifiers(filename='11.tx原创 2020-10-10 16:22:48 · 322 阅读 · 0 评论 -
PC客户端自动化测试-启动或连接应用程序
3 启动程序3.1 使用Application对象的start()方法The timeout parameter is optional, it should only be necessary to use if the application takes a long time to start up。1)Win32 API (backend=“win32”) - a default backend for now界面框架为MFC, VB6, VCL, simple WinForms contr原创 2021-01-08 11:27:56 · 1113 阅读 · 3 评论 -
PC客户端自动化测试-环境搭建
1.安装Python进入python官方下载地址:https://www.python.org/downloads/,下载3.x版本,安装即可。建议3.6以上。2. 安装pywinautoWindows下,按win+R快捷键调出命令窗口,输入python -V确认当前命令使用的python版本,确认好后, 输入pip install pywinauto,按回车进行安装。也可以到https://www.lfd.uci.edu/~gohlke/pythonlibs/#pillow下载离线安装包:原创 2021-01-08 09:44:58 · 1364 阅读 · 0 评论 -
PC客户端自动化测试-背景简介
简介通常情况下,我们大部分应用是web和app的,然而PC客户端软件也有一部分的应用。因此大部分的自动化测试都是针对web和APP,windows客户端自动化很少有涉及。但是因为也有不少应用是windows客户端的,比如notepad、nevicate、QQ桌面版、微信桌面版。今天就来介绍一下windows客户端自动化模块,pywinauto。很显然这是一个python第三方模块。pywinauto是一组用于自动化Microsoft Windows GUI的python模块。 最简单的是,它允许您将鼠原创 2021-01-08 09:09:40 · 1892 阅读 · 0 评论