I want to automate below scenario through Pywinauto.
I can able to open control.exe through below code:
Application().start(r'control.exe', wait_for_idle=False)
app = Application(backend="uia").connect(path='')
I need to get dump_tree to find value on left Panel. What i need to give as path for connect() function
There are two ways to connect to the new window. The first one is using executable name:
app = Application(backend="uia").connect(path='explorer.exe')
But flexible waiting with timeout is not implemented for this case yet. Second way is more reliable and it doesn't require hard-coded time.sleep
s.
app = Application(backend="uia").connect(title="All Control Panel Items", timeout=10)
You need explicit timeout value because of small issue that we will fix in next major release.
To get all top level windows you need app.windows()
and do .window_text()
for each. This case is pretty simple:
main_window = app.window(title="All Control Panel Items")
# only WindowSpecification has .dump_tree() method for now
main_window.dump_tree()