Pywinauto: using multiple application windows
I have a GUI application that can create many similar windows on the desktop. All windows have the same title. I have to list all dialogs with the same title and do some tests against each of such dialogs.
If I call:
dialog = app['Window Name']
pywinauto returns a WindowSpecification object, which is useful along with accessing controls by name.
When I call:
dialogs = app.windows_(title='Window Name')
pywinauto returns me a list of HwndWrapper instances that are not that useful.
How do I get a list of windows with a given title, but as WindowSpecification objects?
a source to share
You can not. WindowSpecification is the only specification for all windows that meet the specified criteria. When you work with a WindowSpecification instance, you often interact with an HwndWrapper instance, which WindowSpecification finds and retrieves for you.
So I think the answer is to work with the HwndWrapper returned by app.windows_ () (similar to the only HwndWrapper returned by WindowSpecification.WrapperObject ()
Note. If you are always trying to narrow the list of windows by looking at specific controls in a window, use the ['Window Name'] ['Unique Control Name'] application. Parent () should return the window.
The main difference between WindowSpecification and HwndWrapper is that WindowSpecification does not exist yet, and the HwndWrapper instance reflects a specific main window handle. This allows WindowSpecification to implement code that waits for windows or checks if they exist.
a source to share