【发布时间】:2020-08-01 01:51:42
【问题描述】:
我正在使用 Python 版本 3.8.2(64 位) 我正在使用 PyWinAuto 0.6.8 版
我正在尝试自动化 Windows 桌面应用程序。我需要将项目添加到列表框。
到目前为止,我可以打印列表框中的项目数。没问题
app = Application()
app.connect(path=r"C:\Program Files (x86)\Example\WindowsFormsApp.exe")
#Get a dialog...
dlg = app.top_window()
dlg.print_control_identifiers()
#Click the 'Generate File' buton'
windowHandle = app.window(best_match='Example Windows Forms App')
listBox = windowHandle.ListBox
print("**********************************")
print(listBox.item_count())
print("**********************************")
有没有人知道我将如何将项目添加到列表框?
【问题讨论】:
-
不确定技术上是否可行。这是编辑任务,而不是自动化任务。您使用哪个后端来创建
app对象? -
老实说,我不确定。 |我没有专门设置后端,所以猜测 PyWinAuto mst 使用默认后端?我将更新我的 orig 中的代码列表。发布,以便您可以看到我使用的代码
-
顺便说一下,我试图访问的控件是 WindowsForms10.LISTBOX 类型的。我们手动将文件拖放到列表框上,文件的路径显示在所述列表框中。我想以编程方式将表示文件路径的字符串添加到列表框。就像你说的,也许这不能完成 - 但我至少想尝试......
标签: python automation ui-automation pywinauto