Ad Home

Theme images by kelvinjay. Powered by Blogger.

Travel

Header Ads

Java

Selenium

UFT

Framework

General QA Concept

BDD

» » Sample DataTable Assignment in QTP

Write a code that will capture Fly from and fly To drop down values..save to a user defined sheet and later Export the run time sheet to user defined Drive...

dataTable.AddSheet("flight")
' this will add a new sheet at last
sheetcnt= datatable.GetSheetCount()
' this will give the total number of sheet count 
datatable.GetSheet(sheetcnt).AddParameter "Fly From",""
' this step will get the sheet created at last and add parameter
 datatable.GetSheet(sheetcnt).addParameter "Fly To",""
' this step will get the sheet created at last and add parameter
itemcount1=  Window("Flight Reservation").WinComboBox("Fly From:").GetItemsCount
'this will give the itemcount from combobox
For i=0 to itemcount1-1
 item1=Window("Flight Reservation").WinComboBox("Fly From:").GetItem(i)
 ' get items one by one
 datatable.setCurrentRow(i)
 'setting current row
 datatable.Value(1,sheetcnt)=item1
     ' set value to the datatable
Next
itemcount2=Window("Flight Reservation").WinComboBox("Fly To:").GetItemsCount
For j=0 to itemcount2-1
 item2=Window("Flight Reservation").WinComboBox("Fly To:").GetItem(j)
 datatable.SetCurrentRow(j)
 datatable.Value(2,sheetcnt)=item2
Next
datatable.ExportSheet "C:\Test\animesh.xls","flight"
'Export datatable to local


«
Next
Newer Post
»
Previous
Older Post

1 comments:

  1. Ran this program but somehow it's overwriting the first city(Denver) in both Fly From and Fly To list.

    ReplyDelete