Good day. I am mastering python and pywinauto automation library. I try to automate actions in one application using WPF.

Screenshot menu

The problem is that you can not select the child sub-menu. Actually code:

from pywinauto.application import Application from os import getenv skif_path = getenv('localappdata') + '\ОАО Финтех\СКИФ-Бюджетный процесс\SkifBP.exe' + ' /SERVER=(localdb)\Fintech /DATABASE=Skif_BP /AUTOLOGON /SSPI=1' app = Application(backend='uia').start(r''+skif_path) main_window = app.window(title='СКИФ-Бюджетный процесс') main_window.wait('ready', timeout=25) top_menu = main_window.child_window(auto_id="TopMenu") menu_service = top_menu.child_window(title="Сервис", control_type="MenuItem") #menu_service.select() - срабатывает нормально item_backup = menu_service.child_window(title="Резервное копирование...", control_type="MenuItem") item_backup.select() 

The "top" items are perfectly selected, but when I try to access a child (for example, "Backup ..."), I get an error that I cannot find the necessary element:

pywinauto.findwindows.ElementNotFoundError: {'title': 'Backup ...', 'control_type': 'MenuItem', 'top_level_only': False, 'parent':, 'backend': 'uia'}

print_control_identifiers gives the correct tree of elements (I copied the descriptions of the elements from the output)

Tell me how to solve this problem.

  • Dots in the menu as ascii recorded or U + 2026? - jfs
  • @jfs, like ascii, but that's not the point. The same problem with child elements without an ellipsis in the name. Forgot to mention that menu_select doesn't see this menu at all. - Maxim Maximov
  • You can of course, as a temporary solution, emulate the selection from the keyboard menu_service.type_keys ('{DOWN 2} {ENTER}') - Maxim Maximov
  • Good day, most likely the problem is that the drop-down menu is not drawn, since its elements have "zero" rectangles, try to select the necessary item first, it is also desirable for clarity after each selection to display a tree of children to check - Boris
  • @Boris I apologize for not answering, it was not possible. I tried to select the desired item, and then select the desired item in it, but it also did not work. If, after selecting a menu item, the tree of window elements is displayed, it turns out that after expanding the menu item, a new menu is created with the name of the type Service DropDown, but it has no child elements: paste.ubuntu.com/26446627 - Maxim Maximov

0