Settings.WebPackage Replaytype in UFT

If you’re reading this blog post, probably you might have written an automation script but some of the steps are not generating the expected result after performing actions like clicking on a button or setting a text in a textbox even though when UFT can easily identify the required objects, and now you are wondering how to figure out this issue.On the off chance that you are confronting similar issues, you have landed on the right post. The solution to such issues is to use Settings.WebPackage ReplayType in UFT using which we can manipulate UFT Web add-in’s replay type from event to mouse, or vise versa.


Let’s get started!

What is ReplayType in UFT

ReplayType is a part of the UFT Web Add-in settings that be changed how the events are replayed on the browser. There are two modes of ReplayType.
  • Events (ReplayType=1) – This is the default value.Replay of events is done using the Browser methods (similar to DOM).
  • Mouse (ReplayType=2) – Replay of events is done using the mouse, and keyboard operations using the keyboard.

When to Use Settings.WebPackage Replaytype 2

There can be any number of scenarios, I am mentioning a few of them

  • There might be a scenario where UFT can identify a button or link object but it is not able to click the same during execution.
  • Upon manually entering a value to a WebEdit box a Submit button is supposed to be enabled but the same is not getting enabled when a value is set to the Textbox using UFT during execution.
  • Upon selecting a value manually from a drop-down “ABC” the corresponding values are supposed to be auto-populated in another drop-down “XYZ”. However, during execution when a value is selected from dropdown “ABC” the corresponding values are not getting populated in the dropdown “XYZ”.
  • Any such type of action that works fine manually whereas doing the same action using UFT does not produce the expected result or does not work. In such a scenario, we should use ReplayType mode 2.Upon setting the value of ReplayType to 2, UFT starts performing actions on the web objects in such a way as a real human being is performing those actions. 

Difference between ReplayType 1 and 2

If the ReplayType is either Event or 1, at runtime the mouse cursor doesn’t move while clicking a button/link/checkbox/radio button or setting a value to any WebEdit, and the required operation is performed directly through the browser event.

However, if ReplayType is Mouse or 2, the mouse cursor is also moved to the web objects while any action is performed. When the ReplayType is 2 each keyboard and mouse action is performed like a real user.

How to Use Settings.WebPackage Replaytype

You can change the default replay type settings by navigating to Tools >Options>GUI Testing>Web>Advanced. Under this find the ReplayType option and select the desired mode. Having said that, it is advisable to change the ReplayType mode using code and reset its default value that is 1 after fulfillment of the purpose.

ReplayType in uft one

Before performing the required action on an object that requires interactions like a real human, follow the below steps:

Step 1: To resolve the issue with the object because of which the problem occurs,change the replay type before the Click / Set / Select operation to Run by mouse operations using.

Setting.WebPackage(“ReplayType”) =2 ‘Set the ReplayType to Mouse

‘Write the code for the required action to be done.e,g clicking a button

Step 2: Reinstate the value of ReplayType after performing the action on the required web object.

Setting.WebPackage(“ReplayType”) =1 ‘Set the ReplayType back to 1.

It is highy recommended to reinstate ReplayType to 1 otherwise, execution time will increase significantly.

Example of Using Settings.WebPackage Replaytype

You can retrieve the current replay mode using the following code:
currReplayMode = Setting.WebPackage(“ReplayType”)

Recommended Posts

This Post Has One Comment

  1. TK

    Great article. This happened to be when I went from 15.02 to UFT 2023 and it works perfectly. My question is why does this happen? I primarily use DP and even highlight the object before a click. The object is highlighted but the click doesn’t work. Does anyone know why this happens or what’s going on? I’ve talked to DEV and they said no changes would affect something like this.

Leave a Reply