Невозможно получить выбранный текст из поля со списком в Pywinauto - PullRequest
0 голосов
/ 23 мая 2019

Невозможно извлечь выбранный текст из поля со списком в Pywinauto, и он непрерывно пытается щелкнуть выпадающий список с домом и шрифтом в бесконечном цикле

'''self.app = Application(backend='uia').start(r'C:\Program Files (x86)\Microsoft Office\Office15\winword.exe')

self.app.wait_cpu_usage_lower(threshold=5) # wait until CPU usage is lower than 5%
self.main = self.app.window(title_re='.* - Word')

self.main.Home_tab.select()
self.main.Ribbon.print_control_identifiers()
print(self.main.child_window(title="Font:", control_type="Edit").selected_text())

also tried with below code as well

font= self.main.Edit1.wrapper_object()
combo = ComboBoxWrapper(font)
print(combo.selected_text())
'''

Идентификатор управления печатью

| | | | | | | | | GroupBox - 'Font' (L158, T51, R421, B142)
| | | | | | | | | ['GroupBox3', 'FontGroupBox', 'Font']
| | | | | | | | | child_window(title="Font", control_type="Group")
| | | | | | | | | |
| | | | | | | | | | ComboBox - 'Font:' (L162, T61, R256, B84)
| | | | | | | | | | ['Font:', 'Font:ComboBox', 'ComboBox', 'ComboBox0', 'ComboBox1']
| | | | | | | | | | child_window(title="Font:", control_type="ComboBox")
| | | | | | | | | | |
| | | | | | | | | | | Edit - 'Font:' (L163, T63, R242, B82)
| | | | | | | | | | | ['6', 'Edit', 'Edit0', 'Edit1']
| | | | | | | | | | | child_window(title="Font:", control_type="Edit")
| | | | | | | | | | |
| | | | | | | | | | | Button - 'Open' (L242, T61, R256, B84)
| | | | | | | | | | | ['Open', 'Button14', 'OpenButton', 'Open0', 'Open1', 'OpenButton0', 'OpenButton1']
| | | | | | | | | | | child_window(title="Open", control_type="Button")
| | | | | | | | | |
| | | | | | | | | | ComboBox - 'Font Size:' (L256, T61, R299, B84)
| | | | | | | | | | ['Font Size:', 'Font Size:ComboBox', 'ComboBox2']
| | | | | | | | | | child_window(title="Font Size:", control_type="ComboBox")
| | | | | | | | | | |
| | | | | | | | | | | Edit - 'Font Size:' (L257, T63, R285, B82)
| | | | | | | | | | | ['7', 'Edit2']
| | | | | | | | | | | child_window(title="Font Size:", control_type="Edit")
| | | | | | | | | | |
| | | | | | | | | | | Button - 'Open' (L285, T61, R299, B84)
| | | | | | | | | | | ['Open2', 'Button15', 'OpenButton2']
| | | | | | | | | | | child_window(title="Open", control_type="Button")
...