Search code examples
pythonwindowsui-automationmessageboxpywinauto

pywinauto to get MessageBox message content


I've googled but did not find the answer. In python 2.7, Windows, it is easy to get TextBox content or MessageBox title by

app.Dialog.Edit.WindowText()
app.Dialog.WindowText()

But I cannot figure out how to get the message content, as in the pic: enter image description here

I've tried something like .Message, .Information, but no use.


Solution

  • It's not an edit box. Use the following:

     app.Dialog.Static1.window_text()
    

    or

     app.Dialog.Static2.window_text()
    

    if message box contains an icon (it would be matched as Static1).