For pywinauto.controls.uia_controls.MenuWrapper, the menu_select method throws an AttributeError: 'MenuWrapper' object has no attribute 'visible'
See original GitHub issueExpected Behavior
No attribute error when calling the menu_select(“menu path”) method on the MenuWrapper class.
Actual Behavior
For pywinauto.controls.uia_controls.MenuWrapper, the menu_select method throws an AttributeError: ‘MenuWrapper’ object has no attribute ‘visible’
Steps to Reproduce the Problem
menu = MenuWrapper(app.ContextMenu.wrapper_object())
menu.menu_select("New->Spread")`
used the code snippet above to select from right click menu (after the menu was made visible in the application by right-clicking)
Short Example of Code to Demonstrate the Problem
Specifications
- Pywinauto version: 0.6.8
- Python version and bitness: Python 3.7 64-bit (Application under test is 64-bit as well)
- Platform and OS: Windows 10
Output from interactive window
>>> menu = MenuWrapper(app.ContextMenu.wrapper_object())
>>> menu.menu_select("New->Spread")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Aju.jayapalan2\Documents\Beta\px_automation_64\lib\site-packages\pywinauto\controls\uiawrapper.py", line 715, in menu_select
self.verify_actionable()
File "C:\Users\Aju.jayapalan2\Documents\Beta\px_automation_64\lib\site-packages\pywinauto\base_wrapper.py", line 680, in verify_actionable
self.verify_visible()
File "C:\Users\Aju.jayapalan2\Documents\Beta\px_automation_64\lib\site-packages\pywinauto\base_wrapper.py", line 702, in verify_visible
if not self.is_visible():
File "C:\Users\Aju.jayapalan2\Documents\Beta\px_automation_64\lib\site-packages\pywinauto\base_wrapper.py", line 325, in is_visible
return self.element_info.visible #and self.top_level_parent().element_info.visible
AttributeError: 'MenuWrapper' object has no attribute 'visible'
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
pywinauto.controls.uiawrapper - Read the Docs
This class wraps a lot of functionality of underlying UIA features for working with windows. Most of the methods apply to every single...
Read more >pywinauto Documentation - Read the Docs
How to deal with controls that do not respond as expected (e.g. ... AttributeError: type object '_CustomLogger' has no attribute 'disable'.
Read more >Cannot Perform MenuSelect with PyWinAuto on Simple VB ...
I am trying to select the "New" Menu item but I receive an error. The error is that there is no Menu. I...
Read more >How To Get Text That Has No Identifier Inside Pane ... - ADocLib
For pywinauto.controls.uiacontrols.MenuWrapper the menuselect method throws an AttributeError: 'MenuWrapper' object has no attribute 'visible' #862.
Read more >更新日志 · Pywinauto 中文文档 - 看云
Method scroll() has been added for all UIA controls which have ScrollPattern ... AttributeError: type object '_CustomLogger' has no attribute 'disable'.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Using your suggestion, I got an AttributeError (on line 721 in menu_select)
For app.ContextMenu.wrapper_object() I got -> <uia_controls.MenuWrapper - ‘Context’, Menu, 3713037277417833081>
Screenshot of the python command line interactive screen. http://bit.ly/35aQ9xH
@airelil is right, but more interesting is what
menu.children()andmenu.descendants()returns. And how it’s compared with whatInspect.exeshows hovering mouse over the menu item (with a hierarchy on screenshot).Anyway I would say our implementation provided useless error message in this case. I will mark the issue as an enhancement to handle context menus more properly. If
menu.children()returnsMenuItemWrapperobjects, the fix should be pretty easy.