C:\Users\xxx>python
Python 3.10.3 (tags/v3.10.3:a342a49, Mar 16 2022, 13:07:40) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from pywinauto.application import Application
>>> app = Application()
>>> app.start("Notepad.exe")
<pywinauto.application.Application object at 0x0000022D6DA1A7A0>
>>> app.无标题.draw_outline()
>>> app.无标题.menu_select("编辑(&E) -> 替换(&R)")
>>> app.替换.print_control_identifiers()
Control Identifiers:
Dialog - '替换' (L332, T735, R987, B1073)
['Dialog', '替换Dialog', '替换']
child_window(title="替换", class_name="#32770")
|
| Static - '查找内容(&N):' (L354, T807, R486, B831)
| ['Static', '查找内容(&N):Static', '查找内容(&N):', 'Static0', 'Static1']
| child_window(title="查找内容(&N):", class_name="Static")
|
| Edit - '' (L492, T801, R806, B837)
| ['Edit', '查找内容(&N):Edit', 'Edit0', 'Edit1']
| child_window(class_name="Edit")
|
| Static - '替换为(&P):' (L354, T858, R486, B882)
| ['替换为(&P):Static', '替换为(&P):', 'Static2']
| child_window(title="替换为(&P):", class_name="Static")
|
| Edit - '' (L492, T852, R806, B888)
| ['Edit2', '替换为(&P):Edit']
| child_window(class_name="Edit")
|
| CheckBox - '全字匹配(&W)' (L354, T918, R640, B954)
| ['CheckBox', '全字匹配(&W)CheckBox', '全字匹配(&W)', 'CheckBox0', 'CheckBox1']
| child_window(title="全字匹配(&W)", class_name="Button")
|
| CheckBox - '区分大小写(&C)' (L354, T966, R516, B1002)
| ['CheckBox2', '区分大小写(&C)', '区分大小写(&C)CheckBox']
| child_window(title="区分大小写(&C)", class_name="Button")
|
| CheckBox - '循环(&R)' (L354, T1014, R530, B1050)
| ['循环(&R)', 'CheckBox3', '循环(&R)CheckBox']
| child_window(title="循环(&R)", class_name="Button")
|
| Button - '查找下一个(&F)' (L822, T792, R960, B834)
| ['查找下一个(&F)', 'Button', '查找下一个(&F)Button', 'Button0', 'Button1']
| child_window(title="查找下一个(&F)", class_name="Button")
|
| Button - '替换(&R)' (L822, T843, R960, B885)
| ['替换(&R)', '替换(&R)Button', 'Button2']
| child_window(title="替换(&R)", class_name="Button")
|
| Button - '全部替换(&A)' (L822, T894, R960, B936)
| ['全部替换(&A)', '全部替换(&A)Button', 'Button3']
| child_window(title="全部替换(&A)", class_name="Button")
|
| Button - '取消' (L822, T945, R960, B987)
| ['取消Button', '取消', 'Button4']
| child_window(title="取消", class_name="Button")
|
| Button - '帮助(&H)' (L822, T1005, R960, B1047)
| ['Button5', '帮助(&H)Button', '帮助(&H)']
| child_window(title="帮助(&H)", class_name="Button")
|
| Static - '' (L354, T1008, R357, B1011)
| ['区分大小写(&C)Static', 'Static3']
| child_window(class_name="Static")
>>> app.替换.取消.click()
>>> app.无标题.Edit.type_keys("Hi from Python interactive prompt %s" % str(dir()), with_spaces = True)
>>> app.无标题.menu_select("文件 -> 退出")
>>> app.记事本.不保存.click()
网友评论