Knowledgebase: Object Recognition
How to recognize Windows system pop-up & notifications?
Posted by Novalys Support on 07 November 2018 06:48 PM

How to recognize Windows system pop-up & notifications?

 

Windows may display system messages on top of your application.

In such cases, you may need to intercept these message, and trigger some specific actions.

This article explains how to detect and handle these windows message.

 

AscentialTest offers a special feature called a 'Handler'.

A handler creates a separate thread to poll for asynchronous popups.

When AscentialTest detects the popup, it calls the 'handler' which can take what ever test action is required.

Below is a copy of the AscentialTest documentation about the AddHandler Method

If you need more information about this, please contact the support team.

 


 

AddHandler Method

Class

AgentObject

Description

Creates a handler for the specified app object.

Syntax

object.AddHandler ( sHandlerName  )

Parameter

Description

sHandlerName

The name of the handler method (string).

Notes

Handlers allow the user to set a trap for a window or dialog. If the window appears, the handler will call its associated handler function to interact with it. Typically, a handler is used to close a dialog that might pop up asynchronously.

Once the handler is activated by the appearance of the window, it must be called again to reactivate it.

The scope of a handler is the current test in which it is activated.

The handler must not be the last action in a test. It must be followed by at least one other action in order to trigger the handler method.

Examples

  void SimpleHandler (AppObject ao)
 ao.OK.Click ()

********** this action is added to a step **************

MyDialog.AddHandler("SimpleHandler")

//if any time during the test in which the step is included MyDialog appears, the handler will be called. The handler will click the 'OK' button in this example and then control will return to the test to continue execution

//if the handler is no longer required, this action is added 



MyDialog.RemoveHandler()

Related 

(0 vote(s))
Helpful
Not helpful

Comments (0)
Help Desk by Novalys