Netsparker Web Application Security Scanner

Add steps on Login action in keyboard View - UFT/QTP Training Tutorial 10

In previous article we have learned about “Overview of UFT Functions and Function Libraries“. Today Let‘s know how to use Keyboard view to work on Login Action in UFT.

Keyboard view represents each action in a step performs by UFT on a particular application.

In this exercise, we will make a flight reservation from New York to San Francisco on the Mercury Tours Web site and will add and show actions performed during this reservation process in step in keyboard view.

First, in UFT window, open the Mercury Tours test and making sure that only the Web Add-in is loaded.

To do so, open UFT, the start page opens. On the Start page, go to the “Recent Solutions” area and click on “Mercury Tours1” to open it. The Mercury Tours1 solution opens.
Second, Open and display the Login action in Keyword View.

If the canvas of Login action is not opened, go to the document pane of the Mercury Tours tab and double-click the Login action. The Login action opens.

If the Login action pane displays in Editor view mode, change it to the Keyword View by clicking on Keyword View button or by View à Keyboard View.

Third, add the first step to Login action.

In the opened Keyword View window, select the Item by directly clicking below the Login row. The Item list opens with object repository and other options. Here, the first test object is the Welcome: Mercury Tours browser object, shown in the given below figure.

Add steps in keyboard View1

Add steps only on objects on which you want to perform operations.In Keyboard view, from the item list, selectObject from repository” to open the Select Test Object dialog box.Select Test Object dialog box opens.

In Select Test Object dialog box, expand the test object tree and select userName and click “OK”, shown in the figure below.

Add steps in keyboard View3

Close the Select Object for Step dialog box. This will add steps to the action with three rows, shown in the figure below.

These three rows are added by UFT for each of the parent test objects, but UFT does not perform an operation on these objects. These rows show the part of the object on which the step has been performed.

During a run time, UFT uses the parent objects to detect the real object on which it needs to execute an operation.

In the given below figure,

Last selected row of item cell displays userName as a WebEdit test object. The Operation cell displays default method “Set”. The Documentation cell displays text indicates that this step clears the text in the edit box. The Value cell field is missing and needs to be field with the required value.

Add steps in keyboard View4

In the Value cell, enter Mercury Tours1.

The step gets over after adding value. When you click another area in the Keyword View, the documentation for this step is updated in the Documentation cell.

Add steps in keyboard View5

For all above process, Editor displays the syntax in VBScript language.

Browser(“Welcome: Mercury Tours”).Page(“Welcome: Mercury Tours”).WebEdit(“userName”).Set “Mercury Tours1”


To go to Editor View, select View > Editor or click on Editor View button. .

Again, click to the Keyword View button to return to the Keyword View.

Fourth, add the next step.

To add the next step, click below the userName row of the Item column. The Item list opens, listing the previous step test object.
Add steps in keyboard View6

Select “password” from the Item list. This adds only one new row because the object shares the same parent objects as the previous step.

Here, Item cell added passwordWebEdit test object.

Operation cell added default method “Set”. Although, password should be encoded form, this method needs to be changed.

The Documentation cell displays text,indicates that this step clears the text in the edit box. This is because value is missing in the Value cell, and needs to be updated with the password.

Click the Operation cell down arrow to display list of methods for the selected test object. From the list, choose “SetSecure” facilitates to use the encrypted text. Generate the encrypted text and put it in the Value cell.

Add steps in keyboard View7

Fifth, use the HP Password Encoder application to create an encoded password.

To do so, go to Tools > Password Encoder. The Password Encoder dialog box opens.

Add steps in keyboard View8

In Password Encoder dialog box, enter Password: Mercury Tours1 and click on “Generate”. The Password Encoder encrypts the password and shows it in the Encoded String box then click on Copy button and Paste the encoded value in the Value cell for the password step, Document cell displays the detail of this step. Close the Password Encoder dialog box.

If you ran your action at this point, UFT would automatically open the Mercury Tours Web site and insert the values you specified in the User Name and Password boxes.

Sixth, add the last step in the Login action.

Click below the last step, in the Item column to add the next step.

The Item list opens, select sign-in from the item list. Follow above technique to add step.

This step instructs UFT to click Sign-In on the Welcome page and log in to the Mercury Tours site.

Seventh, save the test by going to File > Save.


Expand or Collapse the Login Action

In the Keyboard view, under the Item column, click the branch arrows to expand or collapse each Web page steps. Also, can collapse or expand each step by selecting the action name at the top and then go to View > Collapse All or View > Expand All.

When you expand your action, it should look similar to this,

Add steps in keyboard View9

The steps created for Login Action:

Step Description
 Login-Action Action name (Login) is a test unit that divides the test into logical sections.
 Mercury-Tours-Website A browser object calls the Welcome: Mercury ToursWeb site.
 Mercury-Tours-Website The name of the Web page.
 username-set-mercury-tours The edit boxname: “username”Method used for the edit box: “Set”

The edit boxvalue:“Mercury Tours1”

 password-set-mercury-tours The edit boxname: “password”Encryption method used for the edit box: “SetSecure”

The edit boxvalue:“4ffd9cd777f…..”

 signin-click The image linkname: Sign-in”Method used for the image: “Click



Other Tutorial Series


Happy Testing!!!


Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>