1

inspect image

I'm simply trying to press ALT+F then C. The ALT+F works, the file menu opens but the C key isn't being seen. It's possible this is due to the app under test as I've confirmed the same thing does work in Notepad. It's odd though that ALT+F works.

Anyone else ran into this?

I've tried: - type_keys('%fc') - type_keys('%(fc)') - type_keys('%fc{ENTER}')

full code:

    `def open_app(self):
        app = (
            application.Application(backend="win32").start(
                self.app_object.intex_exe
            )
        ).intex
        #app = app.intex
        app.wrapper_object()
        app.wait('visible')
        sleep(1)
        app.type_keys(%fc{ENTER})`

Note - this does work though it's not very elegant: file_menu = { 'file':'%f', 'open_node': '%f{ENTER}', 'close_node': '%f{DOWN}{ENTER}', 'load_rt_app': '%f{DOWN 2}{ENTER}', 'most_recent': '%f{DOWN 3}{ENTER}', 'exit': '%f{DOWN 4}{ENTER}' }

And an hour of other combinations..

I also tried navigating via the menus instead of keys but ran into: "There is no menu" which I've found several posts for here but never a solution that worked.

  • Couldn't find an appropriate app to reproduce this. When you're pressing Alt+F manually and then releasing both keys, is the expanded submenu disappeared? – Vasily Ryabov Jun 21 '17 at 20:22
  • Also need more info to help you access the menu. Which `backend` do you use when creating `Application` object? Are you aware that pywinauto supports both Win32 API (by default) and UI Automation (`backend="uia"`)? Did you read the [Getting Started Guide](https://pywinauto.readthedocs.io/en/latest/getting_started.html)? – Vasily Ryabov Jun 21 '17 at 20:25
  • Thanks for the reply. Here's the code I'm trying: 'app = application.Application(backend="win32").start(self.app_object.intex_exe) app.intex.type_keys('%fc')' When I press ALT+F directly and then release, the submenu stays open. – user2729138 Jun 21 '17 at 23:06
  • So what shows `Inspect.exe` with opened sub menu? Is it possible to add a screenshot to your question? – Vasily Ryabov Jun 22 '17 at 05:49
  • Hi Vasily, I've updated the main post to include more information including a screenshot from inspect when I have the file menu selected. – user2729138 Jun 22 '17 at 15:16
  • Aha, MFC toolbar, nice. It can't be accessed using "win32" backend, but "uia" can do something with that. But it's a little bit tricky. Will try to prepare example with MFC samples we use for unit testing. On my previous job we made window message handlers on the app side for testability. – Vasily Ryabov Jun 22 '17 at 15:33
  • You can see this "toolbar button" has no parent from Inspect.exe point of view. And this is a problem. It can't be found as a child also. – Vasily Ryabov Jun 22 '17 at 15:39
  • Hmm... Tried to make a fast monkey patch but failed for now. Couldn't call method `pywinauto.uia_defines.IUIA().UIA_dll.IUIAutomation().ElementFromPoint` with correct argument. `POINT` structure from pywinauto can't be passed as is. The idea is to put the result of `menu_bar.button(0).rectangle().mid_point()` to `ElementFromPoint` to create AutomationElement for menu bar button. – Vasily Ryabov Jun 29 '17 at 13:03
  • OK, after [this answer](https://stackoverflow.com/q/44826285/3648361) I can make a proof-of-concept script to handle this menu bar using both "win32" and "uia" backends (will post as an answer next week). After that I'll add mixed `MFCToolbarWrapper` to pywinauto 0.6.4 (planned in September for now). Sorry for delays. It's summer. :) – Vasily Ryabov Jul 07 '17 at 08:59
  • I remember about this, but still had no time to make more progress. Plans about September remain the same though. – Vasily Ryabov Jul 26 '17 at 16:14

0 Answers0