RSS Feed

QTP scripts examples for beginner

QTP scripts examples for beginner

Hi friends, This post is useful for fresher who are looking for QTP scripts examples so that they can understand the qtp automation better. If you are advance users than just go through this blog you will get lots of advance QTP VB scripts examples which will be useful for your automation project.

I have listed here two QTP scripts examples specially for fresher, one is related to webpage and other is related to simple GUI (Graphical user interface).

Sample QTP script 1:

SystemUtil.Run “notepad”,””,””,””
Window(“Notepad”).WinEditor(“Edit”).Type “yes”
Window(“Notepad”).WinEditor(“Edit”).Type micCtrlDwn + “s” + micCtrlUp
Window(“Notepad”).Dialog(“Save As”).WinEdit(“File name:”).Set “test”
Window(“Notepad”).Dialog(“Save As”).WinButton(“Save”).Click

Above sample script will open notepad type yes and save as named test at default location.

Note: This is just sample script, This will not work if you just copy and paste it to QTP. You have to first record it. Please Refer to know how to record above script : Getting started to QTP.

Sample QTP script 2:

SystemUtil.Run “http://google.com/“,””,””,””Browser(“Google”).Page(“Google”).WebEdit(“q”).Set “mba” Browser(“Google”).Page(“Google”).WebEdit(“q”).SubmitBrowser(“Google”).Page(“mba – Google Search”).SyncBrowser(“Google”).Close

Above sample script will open google.com and type mba in search box and close it.

Note: This is just sample script, This will not work if you just copy and paste it to QTP. You have to first record it. When you record any webpage its objects will be automatically stored to object repository. Please Refer to know how to record above script : Learn to Automate Webpage.
Visit here to get detail knowledge of QTP object Repository and Learn QTP Step by Step.
Keep visiting this blog, I will share some more advance QTP VB script examples. You are always welcome to give feedback that will improve my blog. I am always trying to give 100% perfect knowledge about QTP.

If you like this article, You can subscribe through mail.

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: