Quick test professional

QTP Tips QTP codes QTP Faqs and more

Can we create the window application with VBScipt?

Can we create the window application with VBScipt?

yes: using HTML Application (HTA)

An HTML Application (HTA) is a Microsoft Windows application written with HTML and Dynamic HTML. The ability to write HTAs was introduced with Microsoft Internet Explorer 5.0.

HTAs can be made from regular HTML files by simply changing the file extension to .hta. A regular HTML file is confined to the security model of the web browser – i.e. to communicating with the server, manipulating the page’s object model (usually to validate forms and / or create interesting visual effects) and reading / writing cookies. An HTA runs as a fully trusted application and therefore has more privileges than a normal HTML file – for example an HTA can create / edit / remove files and registry entries.

To customize the appearance of an HTA, a new tag, with attributes, is introduced: <hta:application …>. This tag appears in the <head>…</head> section of an HTA document.

Because an HTA has more privileges than an HTML page, it cannot be executed via http. Rather, the HTA must be downloaded (just like an EXE file) and executed from local file system.

 QTP code Generates for a HTML Application

QTP generates the code as similar to the normal web applications, except that it shows window instead of browser 

Example: If the  HTML Application has a edit box then code will be

Window(..).Webedit(…).set “value”

Sample code :

This example code creates a HTML app with 3 edit boxes.

<SCRIPT Language=”VBScript”>
Sub SetNameColor

If Len(UserName.Value) <> 0 Then

UserName.style.background = “cyan”


UserName.style.background = “yellow”

End If

End Sub




<input type=”text” name=”UserName” size=”25″ style=”background-color:yellow” onChange=”SetNameColor”><p>


<input type=”text” name=”Address” size=”25″><p>


<input type=”text” name=”Phone” size=”25″><p>


For More information on HTML Application Refer:





February 15, 2008 - Posted by | Extra Topics


  1. Hello,

    I am using QTP9.1 and trying to run the Java Swing Application. Application will working fine but when I click on application window it will give me the co-ordinates of that point. If I click on the button it should have to give me the button name which set in the application while coding. it gives me like below
    window(”WINDOW NAME”): click 116,23
    but actually i want there the button name.
    Please let me know what is wrong in code or I need to do setup in QTP.
    Thanks in advance… 🙂

    Comment by Sanjay | March 12, 2008 | Reply

  2. This problem comes only when the java addin is not installed.
    because if java addin not installed , the qtp identifies only the window , but not the child objects in that window.

    Comment by quicktestprofessional | March 12, 2008 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: