froglogic / All / Squish tip of the week: Handle unexpected events

Squish tip of the week: Handle unexpected events

Did you know that Squish can monitor for various events and dialogs? The events can be handled, allowing scripts to continue where they left off.

For example, in a Windows application you may install an event handler to react to unexpected open message boxes using MessageBoxOpened. The example below demonstrates logging the handled event and closing the message box should the message box appear at any point in the executing script:

def handleMessageBox(messageBox):
    test.log("MessageBox opened: '%s' - '%s'" % (
        messageBox.windowText, messageBox.text))
    messageBox.close()

def main():
    startApplication("myapp")
    installEventHandler("MessageBoxOpened",
                        "handleMessageBox")
    ...
Learn more about using event handlers

2 Comments

Is there a way to log events in the Runner/Server log so that we have a better idea of what events we could be capturing?

Is there an Event for WPF Applications?

Leave a Reply

Your email address will not be published. Required fields are marked *

Copy link
Powered by Social Snap