Share this page

# Typical event handler scenario

In this scenario, Suzy is developing a script. Every now and then, a message pops up asking her to sign up for weekly tips. The message appears at unexpected intervals while performing the business process steps.

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Suzy decides to create an Event Handler that closes this message whenever it appears. Here are the steps she follows to create the event handler:

1. Suzy opens the Event Handler Editor from the main toolbar and clicks the button to add a new Event Handler.

2. Because the message can pop up at any time, in the General section, Suzy selects Event can be triggered during the entire script.

   The handler is an “Object” type because the message appears within a regular DOM object and not within a browser dialog box.

3. Suzy then clicks Choose an object and highlights the “SIGN ME UP!” button.

   After she chooses the object, TruClient creates identification for it:

4. Suzy sets the Event Type to “Object Exists” so the event handler is called each time the message pops up.

Now that the event is defined, Suzy creates a function that ignores the prompt and closes the message. To create the function:

1. She closes the Event Handler Editor and, if the message is not displayed, she browses the application until it pops up.

2. She starts recording and closes the message:

3. She then stops the recording. TruClient recorded a navigation step and the close step. Suzy is only interested in the close step. She will define the close step as the handler.

4. To create the function from the close step, she selects the step, right clicks to open the context menu, and selects Group Into > New Function.

5. When the Create new function dialog box appears, she enters a function name and a library name and clears the Replace steps with function call option so the script itself does not call this function. She wants only her event handler to call the function.

Now Suzy has a new function that contains a single step that closes the message.
The new function is listed in Function Libraries.

Now that Suzy has the function she needs, she opens the Event Handler Editor again and chooses CloseSignUp as the handler function.

Now she can record the business process as usual.

When she encounters the popup message during recording, she stops the recording and deletes the steps associated with it, since the event handler will close the message whenever it pops up in replay.

Back to top

See also:

- Event handlers

https://admhelp.microfocus.com VuGen,Professional Performance Engineering,Performance Engineering for Developers 8942
Tips to improve your search results... OpenText™ Virtual User Generator Help Center OpenText™ VuGen Help 25.1-25.3 All View Local Help Center View Online Help Center Version: