Skip to content
 

Launching QTP application by using script

The below QTP script is used to Launch a ATP application and close th QTP by using a VB Script.

1). Create a folder under ‘C’ drive (c/’qtp-folder’).
2). open a notepad and write the following code and save the notpad as launchqtp.vbs and place this notepad in c/qtp-folder.

code:
“declaring an application object Variable”
Dim qtp-application as QuickTest.Application

“Creating an application object.
Set qtp-application = CreateObject(“QuickTest.Application”)

“Starting the QuickTest”
qtp-application.Launch

“Open new Test”
qtp-application.new

“making the qtp application visible
qtp-application.visible = true
qtp-application.quit

“releasing application object”
set qtp-application = nothing.

3). Go to command prompt (dos prompt) and type ‘cd qtp’. Now you will see like this C:\qtp-folder.
4) then type launchqtp.vbs and press ‘enter’.

Creating an Object(CreateObject):
Create the instance of an object and the reference of the object is stored in a variable of vbscript. After this access the methods and its properties of the object by using variable.methodName and variable.propertyName.

please use the below example on how to open the word application and how to find its version.

Dim WordApplication
Set WordApplication = CreateObject(“word.applicagtion”)
WordApplication.Application.Visible = true
Z = WordApplication.Application.Version
msgbox Z

Write the above code snippet and save it in word-test.vbs.

See you in the next QTP VBScript.

Save on DeliciousDigg This
Submit to StumbleUponTweet