python-3.x 如何在pywinauto中控制或选择列表项

hm2xizp9  于 2023-01-03  发布在  Python
关注(0)|答案(1)|浏览(294)
|    | GroupBox - 'HPF'    (L775, T613, R882, B893)
   |    | ['HPF', 'HPFGroupBox', 'GroupBox2', 'HPF0', 'HPF1']
   |    | child_window(title="HPF", control_type="Group")
   |    |    | 
   |    |    | ListBox - ''    (L775, T613, R882, B893)
   |    |    | ['ListBox']
   |    |    |    | 
   |    |    |    | ListItem - 'HPF'    (L775, T621, R882, B659)
   |    |    |    | ['HPF2', 'ListItem', 'HPFListItem', 'ListItem0', 'ListItem1']
   |    |    |    | child_window(title="HPF", control_type="ListItem")
   |    |    |    | 
   |    |    |    | ListItem - 'LPF'    (L775, T658, R882, B697)
   |    |    |    | ['LPF', 'ListItem2', 'LPFListItem']
   |    |    |    | child_window(title="LPF", control_type="ListItem")
   |    |    |    | 
   |    |    |    | ListItem - 'Peak/Dip'    (L775, T696, R882, B734)
   |    |    |    | ['Peak/DipListItem', 'Peak/Dip', 'ListItem3']
   |    |    |    | child_window(title="Peak/Dip", control_type="ListItem")
   |    |    |    | 
   |    |    |    | ListItem - 'Notch'    (L775, T733, R882, B772)
   |    |    |    | ['NotchListItem', 'ListItem4', 'Notch']
   |    |    |    | child_window(title="Notch", control_type="ListItem")
   |    |    |    | 
   |    |    |    | ListItem - 'HighShelf'    (L775, T771, R882, B809)
   |    |    |    | ['HighShelf', 'HighShelfListItem', 'ListItem5']
   |    |    |    | child_window(title="HighShelf", control_type="ListItem")

如何在pywinauto中控制或选择该列表项
现在如何选择这些项目

app = dlg.ListBox.texts()
print(app)

输出:[[“HPF”]、[“LPF”]、[“峰/谷”]、[“凹口”]、[“高位"]、[”低位"]、[“全通”]]
我试过那件事,我已经收到了这里提到的输出。
现在要期望选择特定的1项

f0brbegy

f0brbegy1#

您可以使用

dlg.ListBox.Select([index of item in list])

你也可以阅读这些文档[https://readthedocs.org/projects/pywinauto/downloads/pdf/stable/]
Select the ListBox item

相关问题