Here is my code which is throwing me an error I am trying to open a Group Policy Editor and select setting under Personalization. I have obtained the sample code from this question GUI Automation of policy change for logoff button. pywinauto.findwindows.ElementNotFoundError: error. How to switch context? import pywinauto pywinauto.Application().start(r'mmc gpedit.msc') app = pywinauto.Application(backend="uia").connect(path='mmc.exe') main_window = app.top_window() main_window.maximize() admin_template = app.LocalGroupPolicyEditor.child_window(title="User Configuration", control_type="TreeItem").child_window(title="Administrative Templates", control_type="TreeItem") admin_template.double_click_input() I get the error saying - There are 50 elements that match the criteria {'title': 'User Configuration', 'control_type': 'TreeItem', 'top_level_only': False, 'parent': <uia_element_info.UIAElementInfo - 'Local Group Policy Editor', MMCMainFrame, 4330080>, 'backend': 'uia'} How do I workaround this error - every query on the internet shares similar code - but it does not work How do I select an entry under Personalization - TreeViewItem. I need to select the DataItem on the right side ex - a setting under Personalization - "Prevent lock screen background motion" and access its values Continue reading...