app()
Function app()
SystemUtil.Run "flight4a.exe","","C:\Program Files\Mercury Interactive\QuickTest Professional\samples\flight\app\","Open"
End Function
'import Data's from Excel Sheet to QTP Global Sheet
Datatable.Import"D:\Velmurugan\Learning\Data\Login.xls"
a=Datatable.GetRowCount
msgbox a
login()
'Open Login window
Function login()
For i=1 to a
Datatable.SetCurrentRow(i)
Dialog("Login").WinEdit("Agent Name:").Set datatable.Value("agentname")
Dialog("Login").WinEdit("Password:").SetSecure datatable.Value("password")
Dialog("Login").WinButton("OK").Click
If Window("Flight Reservation").Exist Then
'Status to Report
Reporter.ReportEvent micPass, "Login","Passed"
Window("Flight Reservation").Close
Else
Dialog("Login").Dialog("Flight Reservations").WinButton("OK").Click
'Status to Report
Reporter.ReportEvent micFail,"Login","Faild"
End If
If Not Dialog("Login").Exist(5) Then
Call app()
End If
Next
End Function
--------------------------*-------------------------*-----------------------------------*----------------
Data’s
Ex-
Hi ,
ReplyDeleteI have run the below code and it is showing error as :
The test run cannot continue due to an unrecoverable error.
The DataTable.Import (file) operation failed. Invalid file.
Line (1): "Dim xl,wb,ws".
Code:
Dim xl,wb,ws
Set xl=createobject ("Excel.Application")
Set wb=xl.Workbooks.Add
Set ws=wb.Worksheets("sheet1")
ws.cells(1,1)="QTP"
ws.cells(2,1)="I love you"
ws.cells(3,1)="This is Raj"
ws.cells(1,2)="Automation"
ws.cells(2,2)="Raj"
ws.cells(3,3)="Hiiiiiiii"
wb.SaveAs "C:\Users\user\Desktop\Srikanth QTP\rajju.xlsx"
wb.Close
Set xl=nothing
Datatable.Import"C:\Users\user\Desktop\Srikanth QTP\rajju.xlsx"
a=Datatable.GetRowCount
msgbox a
Please help me in doing this.
Thanks in advance
in this your using
ReplyDeletedatatable.getsheet("SheetName").getrowcount method ur using