installEventHandler

installEventHandler(eventName, handlerFunctionNameOrReference)

This function installs a global event handler. The script function named or referenced in handlerFunctionNameOrReference, will be called when an event of the eventName type occurs.

The eventName can be the name of any of the following event types:

  • AlertOpened – occurs when an alert box would be shown by the JavaScript window.alert function
  • BodyUnloaded – occurs when the Squish the browser loads a new page or reloads the current page. This event is also sent out for any frames or iframes that Squish was able to hook when they load or reload their content. The handler function receives two parameters. The first parameter is the Squish context name of the window or frame that changes. The second parameter is the location URL of the content that is being unloaded by the browser.
  • ConfirmOpened – occurs when a confirmation (OK/Cancel) box would be shown by the JavaScript window.confirm function
  • Crash – occurs if the AUT crashes
  • ModalDialogOpened – occurs when a modal dialog is opened with the Internet Explorer-specific JavaScript showModalDialog function
  • ModelessDialogOpened – occurs when a modeless dialog is opened with the Internet Explorer-specific JavaScript showModelessDialog function
  • PromptOpened – occurs when a prompt box would be shown by the JavaScript window.prompt function
  • Timeout – occurs when the Squish response timeout is reached
  • WindowOpened – occurs when a new window is opened by the JavaScript window.open function

The function named in handlerFunctionName is called (with no arguments) whenever one of the registered events occurs.

For examples see How to Use Event Handlers.

Note: The installEventHandler function will only work if it is called after the AUT has been started. For example, by using the ApplicationContext startApplication(autName) function.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.
The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation.
Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.

Search Results