Wednesday, 29 April 2015

QTP scripts example

QTP scripts example::::::

here is qtp script example for fax order 
qtp online training


Option Explicit
On Error Resume Next
Dim fileObj,filePtrObj,filePtrObj1,actTxt
Set fileObj=CreateObject("Scripting.FileSystemObject")
Set filePtrObj=fileObj.OpenTextFile("D:\sreekar\test data\faxorders.txt",1,True)
Set filePtrObj1=fileObj.OpenTextFile("D:\sreekar\test
data\faxordersresults.txt",2,True)
While filePtrObj.AtEndOfLine<>"True"
        actTxt=filePtrObj.ReadLine
        actTxt=Split(actTxt," ")
        Window("Flight Reservation").Activate
        Window("Flight Reservation").WinMenu("Menu").Select "File;Open Order..."
        If Window("Flight Reservation").Dialog("Open Order").Exist Then
                Window("Flight Reservation").Dialog("Open Order").Activate
                Window("Flight Reservation").Dialog("Open Order").WinCheckBox("Order
No.").Set "ON"
                Window("Flight Reservation").Dialog("Open
Order").WinEdit("Edit_2").Set actTxt(3)
                Window("Flight Reservation").Dialog("Open Order").WinButton("OK").Click
                If Window("Flight Reservation").Dialog("Open Order").Dialog("Flight
Reservations").Exist(2) Then
                        Window("Flight Reservation").Dialog("Open Order").Dialog("Flight
Reservations").WinButton("OK").Click
                        Window("Flight Reservation").Dialog("Open Order").WinButton("Cancel").Click
                        filePtrObj1.WriteLine actTxt(3)&"   order is not found and hence
unable to sent a fax"
                Else
                        Window("Flight Reservation").WinMenu("Menu").Select "File;Fax Order..."
                        If Window("Flight Reservation").Dialog("Fax Order No. 1").Exist Then
                                Window("Flight Reservation").Dialog("Fax Order No.
1").ActiveX("MaskEdBox").Type actTxt(8)
                                Window("Flight Reservation").Dialog("Fax Order No.
1").WinButton("Send").Click
                                If Window("Flight Reservation").Dialog("Fax Order No.
1").Dialog("Flight Reservations").Exist(2) Then
                                        filePtrObj1.WriteLine actTxt(8)&"  fax number is invalid and
hence unable to send a fax for order "&actTxt(3)
                                        Window("Flight Reservation").Dialog("Fax Order No.
1").Dialog("Flight Reservations").WinButton("OK").Click
                                        Window("Flight Reservation").Dialog("Fax Order No.
1").WinButton("Cancel").Click
                                Else
                                        faxDlgExist=Window("Flight Reservation").Dialog("Fax Order No. 1").Exist
                                        While faxDlgExist="True"
                                                faxDlgExist=Window("Flight Reservation").Dialog("Fax Order No.
1").Exist(2)
                                        Wend
                                        faxMsg=Window("Flight Reservation").ActiveX("Threed Panel
Control").GetROProperty("Text")
                                        If faxMsg="Fax Sent Successfully..." Then
                                                filePtrObj1.WriteLine "Fax Sent successfully for the order "&actTxt(3)
                                        Else
                                                filePtrObj1.WriteLine "Fax not Sent successfully for the order "&actTxt(3)
                                        End If
                                End If
                        End If
                End If
        End If

Wend
'killing user defined objects
Set filePtrObj1=Nothing
Set filePtrObj=Nothing
Set fileObj=Nothing


qtp script example, qtp sample script, qtp online training, qtp 10, qtp 10  license key, online training software, software training,

No comments:

Post a Comment