I've got a python script 3.9.7 64-bit that uses PyWinAuto to automate an application.
I have a long operation in my application
and the app raise an exception of timeout while trying two ways of doing it
Is there a way to wait for process to end without timeout?
first way :
Application(backend="uia").start(reg360path)
reg360App = Application(backend="uia").connect(path=reg360path, title='Cyclone REGISTER 360')
while(reg360App.CycloneREGISTER360.Publishing.exists()):
if(reg360App.CycloneREGISTER360.PublishResults.exists()):
break
second way:
Application(backend="uia").start(reg360path)
reg360App = Application(backend="uia").connect(path=reg360path, title='Cyclone REGISTER 360')
publishing_is_on = False
while not publishing_is_on:
if(reg360App.CycloneREGISTER360.PublishResults.wait('enabled')):
publishing_is_on = True
Both ways raise error timeout
Methods wait()
and exists()
have parameter timeout
. Just set large enough timeout in seconds:
# wait for up to 10 minutes
reg360App.CycloneREGISTER360.PublishResults.wait('enabled', timeout=600)
# or
reg360App.CycloneREGISTER360.child_window(title="Publishing").wait_not('exists', timeout=600)
# or
reg360App.CycloneREGISTER360.PublishResults.exists(timeout=600)
Exact matching for title="Publishing"
is better because usual attribute access .Publishing
is resistant to a typo. Words "Publishing" and "PublishResults" may be too similar (I didn't test it, it's just a guess).