Qtp Scripts


Published on

qtp scripts for connecting to database,datadriven testing,timeout for messagebox,to create folder in system,yahoo login

Published in: Technology, Education
  • Hi,

    Technology Specific Guide for QTP is a new book that has got great feedback from all the readers. It will get you started on the path of automation, introducing solutions, roadblocks, patches and ideas that will give you a solid foundation in the field of automation. Everyone from a novice user to an automation expert will have something they would have never heard of or used.


    Best Regards,

    Are you sure you want to  Yes  No
    Your message goes here
  • Nice ppt...Thanks a lot for sharing...
    Friends. Visit here for more QTP sample scripts... and let me know if require any kind of help on QTP
    Are you sure you want to  Yes  No
    Your message goes here
  • Hi PowerDown,

    Even though you have limited connection at home you can download these presentations by just clicking the download link on the top of the presentation. It will not take much time to download it.

    Since you are new to QTP you can get more information step by step right from how to launch QTP 9.2 and how to work about in it by visiting my blog. All the information is given in a detailed way and is easy to understand.

    Please visit my blog on QTP 9.2 for better understanding at


    For information on VB Scripting and how to use it in QTP 9.2 visit another blog at


    Kiran Paul
    Are you sure you want to  Yes  No
    Your message goes here
  • Hi I'm new to this slideshare and qtp. These slides are very usefull and i've limited access to internet on my home. How to download those presentations to my desktop?
    Are you sure you want to  Yes  No
    Your message goes here
  • Dear Friends,

    For real time concepts on quicktest professional, training , QTP scripts and Certification Material, you can visit quicktesthp.blogspot.com . The posts are updated regularly. If anyone would like to contribute, please feel free to contact me. Refer my blog for contact details..

    Blog Address


    For basic tutorials on QTP, you can visit



    Keywords: QTP, quicktest, hp, qtp certification, quicktest professional, qtp training, qtp help, checkpoint, data table, qtp blog, qtp advanced concepts
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Qtp Scripts

  1. 1. QTP SCRIPTS http://www.funandknowledge.blogspot.com/
  2. 2. QTP Script for connecting to database(MS Access) Option Explicit Dim con,rs Set con=createobject("adodb.connection") Set rs=createobject("adodb.recordset") con.provider="microsoft.jet.oledb.4.0" con.open"d: estdata.mdb" rs.open"select*from emp",con Do while not rs.eof VbWindow("Form1").VbEdit("val1").Set rs.fields("v1") VbWindow("Form1").VbEdit("val2").Set rs.fields("v2") VbWindow("Form1").VbButton("ADD").Click rs.movenext Loop
  3. 3. Database we are using here is MS Access.before running this script create a table in MS Acess. In the above script i used table called "emp" and column names as "v1" and "v2". "d: estdata.mdb" is path of the table which we created. Main use of this application is to use testdata of table(which is in database) in the application. http://www.funandknowledge.blogspot.com/
  4. 4. DataDriven Testing using ExcelSheet instead of Datatable This is script for data driven using excel sheet. In this script we are not importing excel sheet to datatable.Directly values are supplied to application from excel sheet. Set ex= CreateObject("Excel.Application") Set a=ex.Workbooks.open("D:excel.xls") Set b=a.worksheets("Sheet1") dim login,pwd for i=1 to 3 login=b.Cells(i,"A").value pwd=b.Cells(i,"B").value msgbox login msgbox pwd next
  5. 5. "D:excel.xls" is path of excel sheet. "sheet1"indicates sheet name in which values are present. A,B are column names in excel sheet. we have excel sheet with values as shown below in d drive. A B 1 2 3 4 5 6 http://www.funandknowledge.blogspot.com/
  6. 6. Descriptive Programming to Create Folder in System Set obj=createobject ("scripting.filesystemobject") Set notepad=obj.createfolder("d:bc") this script will create a folder named "abc" in "d" drive. http://www.funandknowledge.blogspot.com/
  7. 7. Timeout for MessageBox Script for MessageBox to disappear after particular time without clicking on ok button manually . Set a=createobject("wscript.shell") msgbox_message="Message Box will close by itself in 10seconds so dont click on OK button" msgbox_time="10" msgbox_title="Testing" a.popup msgbox_message,msgbox_time,msgbox_title Where time is in seconds. http://www.funandknowledge.blogspot.com/
  8. 8. Descriptive Programming for Yahoo Login Page SystemUtil.Run"iexplore","http://www.yahoomail.com" Set g=Browser("name:=Yahoo.*").Page("title:=Yahoo.*") g.WebEdit("name:=login").Set "aaa" g.WebEdit("name:=passwd").SetSecure "bbb" g.WebButton("name:=Sign In").Click g.Link("name:=Inbox.*", "html id:=WelcomeInboxFolderLink").Click g.Link("name:=Sign Out").Click http://www.funandknowledge.blogspot.com/
  9. 9. SystemUtil.Run"iexplore","http://www.yahoomail.com" statement opens yahoo login page aaa=username bbb=password For more QTP Scripts