Reputation: 63
I'm currently trying to learn the ins and outs of pywinauto for python 2.7 however I'm having a hard time with a few concepts.
I know how to right click something and get a menu to pop up but after that how do I select or click anything on the popped up menu?
I've tried quite a few ways but nothing seems to be working.
from pywinauto.application import Application
app = Application().Connect(title=u'Untitled - Notepad',
class_name='Notepad')
notepad = app.Notepad
notepad.RightClickInput()
notepad.MenuSelect('Paste')
This is just my latest attempt. I'm fairly new to programming so the concepts aren't coming easily to me.
Any suggestions on how this could be accomplished would be greatly appreciated.
Upvotes: 4
Views: 2615
Reputation: 9991
Popup menu is a top-level window for win32
backend. Usually it can be accessed so:
app.UntitledNotepad.right_click_input()
app.PopupMenu.menu_item('Select &All').click_input()
Available texts can be printed using list comprehension:
print [item['text'] for item in app.PopupMenu.menu_items()]
Upvotes: 4