Understand SystemUtil.Run, SetSecure, Set, Type: QTP/UFT Examples

Let’s understand the following piece of code

SystemUtil.Run "C:\Program Files\HP\samples\flight\app\flight.exe"
Dialog("Login").WinEdit("Agent Name:").Set "Guru"
Dialog("Login").WinEdit("Agent Name:").Type micTab
Dialog("Login").WinEdit("Password:").SetSecure "4af272a62666d2e"
Window("Flight Reservation").Close
  • The first step is the SystemUtil.Run Command which is used by default by UFT/QTP to open an application. During recording, using the Windows Start Menu, we navigated to the “Flight Reservation” application. At that time, Micro Focus UFT identified the location of its executable file and inserted the System.Util Command to Open it.
  • Line 2 is Setting Agent Name as Guru as shown in the Active Screen
  • Line 3 is Pressing the Tab key on a keyboard to bring Focus from Agent Name Field To Password Field, which is exactly this step. Human users need to use tab or click operations to focus on a particular object on screen… On the other hand, QTP can directly identify an object using object properties and does not require these “maneuvering” operations. We can delete this step, as QTP will still be able to set the password field without this operation
  • Line 4 is Setting the Password as Mercury. HP QTP automatically encrypts passwords entered while recording to avoid security breaches. This value cannot be decrypted i.e. there is no way to recover the original value using this cryptic data. You can explicitly encrypt a password using the Password Encoder Tool. For our learning purposes, we will use the password in its raw form. And the operation will also change to Set
  • Line 5 is clicking the okay button
  • Line 6 is closing the window

Click here if the video is not accessible