Can Pywinauto Track or Log Error with an Application?
<p>Is there any way to track or log error in Pywinauto (eg a pop-up window does not appear, etc.) ?  I am trying to track if a window opens correctly or not. I am also trying to verify values in an Excel Worksheet.  Is this possible ?  Oh!  Yes, I am a newbie to Python and Pywinauto.  Thanks for your assistance !!</p>

<p>For working with MS Excel I would recommend using standard <code>win32com.client</code> module (it's included into ActivePython, or pyWin32 extensions can be installed by <code>pip install pypiwin32</code> for example). Almost every Microsoft application has nice <code>IDispatch</code> COM interface. By the way standard docs example shows MS Excel usage. ;)</p>

<p>For handling window opening pywinauto contains <code>.Wait('ready')</code> method for the window specification. So something like that should work or raise an exception in case of failure:</p>

<pre><code>app.MainWindowTitle.Wait('ready') # 'ready' == 'exists visible enabled'
# or
app.Window_(title_re='^some regular expr - .*$', class_name='#32770').Wait('visible enabled')
</code></pre>

<p>You can do the same if the window is closing:</p>

<pre><code>app.SomeDialog.WaitNot('exists', timeout=20) # default or implicit timeout is 5 sec.
</code></pre>

<p>If you need <code>bool</code> return value instead of raising an exception, then use methods <code>.Visible()</code>, <code>.Exists()</code>, <code>.Enabled()</code> and <code>.IsActive()</code>.</p>

python pywinauto