pywinauto实战-操作h2testw.exe自动化测试脚本

"""
h2testw.exe自动化测试脚本
Requirements:
  - tested on Windows 10 (should work on Win7+)
  - pywinauto 0.6.1+
"""
from __future__ import print_function
import logging
from pywinauto import actionlogger
from pywinauto import Application
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--log", help = "enable logging", type=str, required = False)
args = parser.parse_args()
actionlogger.enable()
logger = logging.getLogger('pywinauto')
if args.log:
    logger.handlers[0] = logging.FileHandler(args.log)
app = Application(backend='uia').start(r'D:\h2testw.exe')
dlg = app.window(title_re='H2testw')
dlg['简体中文'].click()
dlg['选择对象'].click()
#dlg.child_window(title='浏览文件夹', control_type='MenuItem', found_index=0).invoke()
file_name_edit = dlg['浏览文件夹'].child_window(title="文件夹(F):", control_type="Edit")
file_name_edit.set_text(r'D:')
dlg['浏览文件夹'].child_window(title="确定", auto_id="1", control_type="Button").click()
dlg['仅'].click()
file_name_edit2 = dlg['H2testw'].child_window(title="",auto_id="1", control_type="Edit")
dlg['Edit'].set_text(r'1024')
dlg['写入 + 校验'].click()
dlg['确定'].click()

pywinauto实战-操作h2testw.exe自动化测试脚本_第1张图片

你可能感兴趣的:(python学习总结)