QTP 11 Software

QTP 11 Software

Dear Professionals,

Latest Version of the QTP is:  QTP 11.00
Trail period is: 30 Days
 If you want to download and use, it takes more time and efforts, in order to reduce the cost and efforts, we downloaded and extracted the Software and planned to provide with free of cost.

———————————————————————————–
———————————————————————
 File System Operations
———————————————————————-
‘Create a Folder
Dim objFso
Set objFso=CreateObject(“Scripting.FileSystemObject”)
objFso.CreateFolder “C:Documents and SettingsAdministratorDesktopQTP”
Set objFso=Nothing ‘Releasing the Memory

———————————————
‘Check the existence of the Folder, If Not exists then Create the Folder
Dim objFso, FolderPath
FolderPath=”C:Documents and SettingsAdministratorDesktopQTP”
Set objFso=CreateObject(“Scripting.FileSystemObject”)

If Not objFso.FolderExists(FolderPath) Then
objFso.CreateFolder (FolderPath)
End If
Set objFso=Nothing
—————————————————-
‘Copy a Folder
Dim objFso, FolderPath
FolderPath=”C:Documents and SettingsAdministratorDesktopQTP”
Set objFso=CreateObject(“Scripting.FileSystemObject”)
objFso.CopyFolder FolderPath,”E:QTPx”

Set objFso=Nothing
—————————————————

‘Delete a Folder
Dim objFso
Set objFso=CreateObject(“Scripting.FileSystemObject”)
objFso.DeleteFolder “C:Documents and SettingsAdministratorDesktopQTP”

Set objFso=Nothing
—————————————————————-
‘Check the existence of the Folder, If Exists then Delete the Folder
Dim objFso
Set objFso=CreateObject(“Scripting.FileSystemObject”)

If objFso.FolderExists(“C:Documents and SettingsAdministratorDesktopQTP”)  Then
objFso.DeleteFolder “C:Documents and SettingsAdministratorDesktopQTP”
End If

Set objFso=Nothing
———————————————————————-
‘Create a Text/Flat File
Dim objFso
Set objFso=CreateObject(“Scripting.FileSystemObject”)
objFso.CreateTextFile “C:Documents and SettingsAdministratorDesktopQTP.txt”
objFso.CreateTextFile “C:Documents and SettingsAdministratorDesktopQTP.doc”
objFso.CreateTextFile “C:Documents and SettingsAdministratorDesktopQTP.xls”
objFso.CreateTextFile “C:Documents and SettingsAdministratorDesktopQTP.pdf”
Set objFso=Nothing
——————————————————————————

‘Read a Text file Char by Char
Dim objFso, objTextstream, myChar
‘Creating File System Object
Set objFso=CreateObject(“Scripting.FileSystemObject”)
‘Creating Text Stream Object
Set objTextstream=objFso.OpenTextFile (“C:Documents and SettingsAdministratorDesktopqtp.txt”,1) ‘1 for Read, 2 for Write, 8 for Append
Do Until objTextstream.AtEndOfStream
myChar=objTextstream.Read(1)
Msgbox myChar
Loop

objTextstream.Close ‘internal closing of the file
Set objTextstream=Nothing
Set objFso=Nothing

——————————————————–
‘Read a Text file Line by Line
Dim objFso, objTextstream, myLine
‘Creating File System Object
Set objFso=CreateObject(“Scripting.FileSystemObject”)
‘Creating Text Stream Object
Set objTextstream=objFso.OpenTextFile (“C:Documents and SettingsAdministratorDesktopqtp.txt”)

Do While objTextstream.AtEndOfStream =False
myLine=objTextstream.ReadLine
Msgbox myLine
Loop

objTextstream.Close
Set objTextstream=Nothing
Set objFso=Nothing
————————————————————————
‘Read a Text file and Count Lines
Dim objFso, objTextstream, myLine, Counter
Set objFso=CreateObject(“Scripting.FileSystemObject”)
Set objTextstream=objFso.OpenTextFile (“C:Documents and SettingsAdministratorDesktopqtp.txt”)

Counter=0
Do While objTextstream.AtEndOfStream =False
myLine=objTextstream.ReadLine
Counter=Counter+1
Loop
Msgbox Counter
objTextstream.Close
Set objTextstream=Nothing
Set objFso=Nothing
—————————————————————————
‘Read a Text file
Dim objFso, objTextstream, myContent
Set objFso=CreateObject(“Scripting.FileSystemObject”)
Set objTextstream=objFso.OpenTextFile (“C:Documents and SettingsAdministratorDesktopAugustBatch.txt”)

Do While objTextstream.AtEndOfStream =False
myContent=objTextstream.ReadAll
Print myContent
Loop
objTextstream.Close
Set objTextstream=Nothing
Set objFso=Nothing
—————————————————————-
‘Read a Text file and Perform data driven testing for Login Operation
Dim objFso, objTextstream, myLine, myField
Set objFso=CreateObject(“Scripting.FileSystemobject”)
Set objTextstream=objFso.OpenTextFile (“C:Documents and SettingsAdministratorDesktopQTP.txt”)

objTextstream.SkipLine
While objTextstream.AtEndOfStream=False
myLine=objTextstream.ReadLine
myField=Split(myLine,”,”)

SystemUtil.Run “C:Program FilesHPQuickTest Professionalsamplesflightappflight4a.exe”,””,”C:Program FilesHPQuickTest Professionalsamplesflightapp”,”open”
Dialog(“Login”).Activate
Dialog(“Login”).WinEdit(“Agent Name:”).Set myField(0)
Dialog(“Login”).WinEdit(“Password:”).Set myField(1)
Wait 1
Dialog(“Login”).WinButton(“OK”).Click
Window(“Flight Reservation”).Close
Wend

objTextstream.Close
Set objTextstream=Nothing
Set objFso=Nothing
————————————————
‘Read a Text file and Perform data driven testing for Login Operation
Dim objFso, objTextstream, myLine, myField
Set objFso=CreateObject(“Scripting.FileSystemobject”)
Set objTextstream=objFso.OpenTextFile (“C:Documents and SettingsAdministratorDesktopQTP.txt”)

Do Until objTextstream.AtEndOfStream
Line_Count=objTextstream.ReadLine
Counter=Counter+1

If  Counter>=3 And  Counter <=7 Then
myField=Split(Line_Count,”,”)

SystemUtil.Run “C:Program FilesHPQuickTest Professionalsamplesflightappflight4a.exe”,””,”C:Program FilesHPQuickTest Professionalsamplesflightapp”,”open”
Dialog(“Login”).Activate
Dialog(“Login”).WinEdit(“Agent Name:”).Set myField(0)
Dialog(“Login”).WinEdit(“Password:”).Set myField(1)
Wait 1
Dialog(“Login”).WinButton(“OK”).Click
Window(“Flight Reservation”).Close
End If
Loop

objTextstream.Close
Set objTextstream=Nothing
Set objFso=Nothing
———————————————————————–
‘Write Data to a Text file
Dim objFso, objTextstream, num1, num2, res
num1=10 : num2=23 : res=num1+num2
Set objFso=CreateObject(“Scripting.FileSystemobject”)
Set objTextstream=objFso.OpenTextFile (“C:Documents and SettingsAdministratorDesktopQTP.txt”,8)
objTextstream.Write “Addition of num1, num2 is: “&res
objTextstream.Close
Set objTextstream=Nothing
Set objFso=Nothing
——————————————————-
‘Capture Button names from Login Dialog and export to a Text File
Dim objFso, objTextstream
Dim oButton, Buttons, i

Set objFso=CreateObject(“Scripting.FileSystemobject”)
Set objTextstream=objFso.OpenTextFile (“C:Documents and SettingsAdministratorDesktopQTP.txt”,2)

Set oButton=Description.Create
oButton(“Class Name”).Value=”WinButton”
Set Buttons=Dialog(“text:=Login”).ChildObjects(oButton)
objTextstream.WriteLine “Button Names”
objTextstream.WriteLine “———-”

For i= 0 to Buttons.Count-1 Step 1
myButton=Buttons(i).GetRoProperty(“text”)
objTextstream.WriteLine myButton
Next

objTextstream.Close
Set objTextstream=Nothing
Set objFso=Nothing
———————————————————————–

 

Comments