WindowSpecification
A specificiation for finding a window or control
The WindowSpecification class is accessible via the pywinauto.application module.
Windows are resolved when used. You can also wait for existance or non existance of a window
Methods
f __init__(self, app, search_criteria) ...
Initailize the class
- search_criteria the criteria to match a dialog
f Window_(self) ...
Add criteria for a control
When this window specification is resolved then this will be used to match against a control.
f window_(self) ...
Add criteria for a control
When this window specification is resolved then this will be used to match against a control.
f __getitem__(self, key) ...
Allow access to dialogs/controls through item access
This allows:
app.['DialogTitle']['ControlTextClass']
to be used to access dialogs and controls.
Both this and __getattr__ use the rules outlined in the HowTo document.
f Wait(self, wait_for, timeout=None, retry_interval=None) ...
Wait for the window to be in a particular state
wait_for The state to wait for the window to be in. It can be any of the following states
- 'exists' means that the window is a valid handle
- 'visible' means that the window is not hidden
- 'enabled' means that the window is not disabled
- 'ready' means that the window is visible and enabled
- 'active' means that the window is visible and enabled
timeout Raise an error if the window is not in the appropriate state after this number of seconds.
retry_interval How long to sleep between each retry
e.g. self.Dlg.Wait("exists enabled visible ready")
See also: Application.WaitNot()
f WaitNot(self, wait_for_not, timeout=None, retry_interval=None) ...
Wait for the window to not be in a particular state
wait_for The state to wait for the window to not be in. It can be any of the following states
- 'exists' means that the window is a valid handle
- 'visible' means that the window is not hidden
- 'enabled' means that the window is not disabled
- 'ready' means that the window is visible and enabled
- 'active' means that the window is visible and enabled
timeout Raise an error if the window is sill in the state after this number of seconds.(Optional)
wiat_interval How long to sleep between each retry (Optional)
e.g. self.Dlg.WaitNot("exists enabled visible ready")
See also: Application.WaitNot("exists enabled visible ready")
f PrintControlIdentifiers(self) ...
Prints the 'identifiers'
If you pass in a control then it just prints the identifiers for that control
If you pass in a dialog then it prints the identiferis for all controls in the dialog
| Note: | The identifiers printed by this method have not been made unique. So if you have 2 edit boxes, they will both have "Edit" listed in their identifiers. In reality though the first one can be refered to as "Edit", "Edit0", "Edit1" and the 2nd should be refered to as "Edit2". |
|---|
f print_control_identifiers(self) ...
Prints the 'identifiers'
If you pass in a control then it just prints the identifiers for that control
If you pass in a dialog then it prints the identiferis for all controls in the dialog
| Note: | The identifiers printed by this method have not been made unique. So if you have 2 edit boxes, they will both have "Edit" listed in their identifiers. In reality though the first one can be refered to as "Edit", "Edit0", "Edit1" and the 2nd should be refered to as "Edit2". |
|---|
See the source for more information.