Trying to open Start->Services window and connect pywinAuto
Application to Services window using the title ‘Services’, But the application is not connecting to above mentioned window. The code written to open a Services window and connect with it is as mentioned below:
def search_webroot_in_services():
childWindowFile="C:\Girish\DnsAutomation\childWindow.txt"
try:
#--------------------------
desktop = Desktop(backend='uia')
# click to open 'start' menu
desktop.Pane.Start.click_input()
desktop.StartMenu.child_window(auto_id="SearchTextBox", control_type="Edit").type_keys('services')
keyboard.send_keys('{ENTER}')
#Below line of code is not working
app=Application(backend='uia').connect(title="Services",timeout=10)
app.Services.print_control_identifiers()
except Exception as e:
print(f"Error searching in Services Programs: {str(e)}")
return False
Would like to connect to Services app, and check if the required services is running is the purpose of writing above code. The image of the Services window being tried to automate is attached.
Tried connecting the Services window using below code, but its not working.
app=Application(backend='uia').connect(title="Services",timeout=10)
Most probably “Services” window is implicitly started as Administrator (some system apps don’t ask UAC confirmation) and you must run your script (or IDE or
python.exe
) as Administrator too (by right click menu item or by setting a shortcut.lnk
file properties to always run as Administrator).