'Python Pywinauto module : How to make a selection from Windows 10 taskbar right-click options

I'm able to right click on the taskbar using the following code from pywinauto import taskbar

#taskbar.TaskBar.print_control_identifiers() taskbar.TaskBar.Button.right_click()

But when I tried to select a menu item such as Cascade windows, I've been unsuccessful

cascade = taskbar.TaskBar.Button.right_click().child_window(title="Cascade windows", control_type="MenuItem").wrapper_object() cascade.click_input()

I was wondering if you can help me with giving me an idea as to how can I select other right-click options from Windows 10 taskbar like:

Cascade windows Show windows stacked Show windows side by side

using pywinauto.

Thank you.



Solution 1:[1]

i faced a problem kinda similar to yours and that was my solution:


import pywinauto 

from pywinauto import taskbar

explorer = pywinauto.application.Application().connect(path = "explorer.exe")
pywinauto.controls.hwndwrapper.HwndWrapper(pywinauto.taskbar.TaskBarHandle()).right_click()
print(explorer.PopupMenu.menu().get_menu_path("Show windows side by side")[0].click_input())

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Peter Csala