Search code examples
pythonui-automationpywinauto

Pywinauto - How to wait on UIAWrapper windows


I'm trying to wait on a specific window (that I found using the children method from the top window) but it seems that the UIAWrapper doesn't have the wait method.

What can be done to use wait on this window? or maybe convert the UIAWrapper object to the WindowSpecification object?

So for example, I can do this:

app.top_window().wait("enabled")

But I can't do this:

app.top_window().children()[0].wait("enabled")

Solution

  • Let's combine all the comments. This feature request could be implemented in next major release pywinauto-0.7.0. See issue #434.

    Current workaround:

    from pywinauto.timings import wait_until
    
    wrapper = app.top_window().children()[0]
    wait_until(timeout=5, retry_interval=0.1, wrapper.is_enabled)