Write a script to invole and login to the Flight Application using data from an external Excel Sheet

'Create an Object Variable to interact with Excel Library

Set xlapp = CreateObject("Excel.Application")

'Open the existing workbook

Set wbook = xlapp.Workbooks.Open("E:\Practise sets\Test Data\LoginFR.xls")

'Create a pointer to the first sheet in the workbook

Set wsheet = xlapp.WorkSheets(1)

'Get the row count

rowcount = wsheet.usedrange.rows.count

For i = 1 to rowcount-1
If not Dialog("Login").Exist(0) Then
InvokeApplication "C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\flight4a.exe"
End If

Dialog("Login").Activate
Dialog("Login").WinEdit("Agent Name:").Set wsheet.cells(i+1,1).Value
Dialog("Login").WinEdit("Password:").Set wsheet.cells(i+1,2).Value
Dialog("Login").WinButton("OK").Click
Wait 8
If Window("Flight Reservation").Exist(8) Then
wsheet.cells(i+1,3).Value = "Pass"
wsheet.cells(i+1,3).Font.Colorindex = 10
Else
wsheet.cells(i+1,3).Value = "Fail"
wsheet.cells(i+1,3).font.colorindex = 3
End If

Window("Flight Reservation").Close

Next
wbook.save
wbook.close
xlapp.quit

Set wsheet = nothing
Set wbook = nothing
Set xlapp = nothing

0 comments:

Post a Comment

/* Tynt Insight tracker ----------------------------------------------- */