pywinauto app自动化的实践
作者:互联网
from pywinauto import Application app = Application(backend='uia').start("notepad") # print(app.windows()) # # 无标题 - 记事本 dlg = app.YourDialogTitle # print(dlg) np=app["无标题 - 记事本"] np['Edit'].type_keys("九零五五五五五五") # np['Edit'].type_keys("九零五五五五五五\r\n") # np['Edit'].type_keys("九零五五五五五五\r\n") # np['Edit'].type_keys("九零五五五五五五\r\n") np['编辑(E)'].click_input() # np['替换(R)... Ctrl+H'].click_input() # print( np.dump_tree()) np.menu_select('编辑(E) ->替换(R)... Ctrl+H') # print(np.children()) # np['替换']['查找内容(N):'].set_text("我爱你") np['替换'].child_window(title="查找内容(N):", auto_id="1152", control_type="Edit").set_text("五五五") np['替换'].child_window(title="替换为(P):", auto_id="1153", control_type="Edit").set_text("替换") np['替换'].child_window(title="全部替换(A)", auto_id="1025", control_type="Button").click() np['替换'].child_window(title="全部替换(A)", auto_id="1025", control_type="Button").close() np.menu_select('文件(F) ->保存(S) Ctrl+S') # print(np.children()) print(np.dump_tree()) # np['另存为'].child_window(auto_id="41477", control_type="Pane").set_text("D:\\") np['另存为'].child_window(auto_id="41477", control_type="Pane").click() np['另存为'].child_window(title="文件名:", auto_id="1001", control_type="Edit").set_text("abc.txt") np['另存为'].child_window(title="保存(S)", auto_id="1", control_type="Button").click()
标签:control,pywinauto,app,child,id,自动化,np,type,五五 来源: https://www.cnblogs.com/jiapengchu/p/16609142.html