In an application you have a web table. You are provided
with an external Excel sheet with the same structure as that
of the web table.
How will you retrieve all data from the web table and
compare it with corresponding data available in the excel
sheet, using QTP?
How will you report the results in QTP?



In an application you have a web table. You are provided with an external Excel sheet with the same..

Answer / saket bharti

'Get the Web Table Row and Col count using the GetROProperty

rowcount=
Browser("").Page("").WebTable("").GetRoProperty("rows")

colcount=
Browser("").Page("").WebTable("").GetRoProperty("cols")

'Create a Excel COM object to read the data from the file.
Set excelobj=CreateObject("Excel.Application")
Set excelbooks=excelobj.Workbooks.open("C:\Data-excel.xls")
Set excelsheets=excelobj.Worksheets.item("Sheet1")

'Now loop through the excel and the wettable and check their
values

for i=0 to rowcount
for j=0 to colcount

if (
Browser("").Page("").WebTable("").GetCellData(i,j)=excelsheets.Cells(i,j))
Then

Reporter.ReportEvent micPass ,"Validation","Cell values & i
& j are same"

Else

Reporter.ReportEvent micFail ,"Validation","Cell values & i
& j do not match"

End If

Next
Next

Is This Answer Correct ?    8 Yes 1 No

Post New Answer

More QTP Interview Questions

how to count the word "IS" is repeated in the application using DP

3 Answers   DST Global Solutions,


who QTP recognizes the object stored in object repository?

0 Answers   Infosys, Mphasis,


Get the count of files of similar types from a folder.

0 Answers   Deloitte,


What are the disadvantages of recording test cases in qtp?

0 Answers  


Hai anyone please "Explain about Framework in QTP?"

0 Answers  






in process of project exaplnation the defects are says frequently r not?

1 Answers  


Explain key word driven frame work?How to use in real time?

2 Answers   HP,


Which advantages helping QTP to hold the position of "Market Leader" for such a long period?

0 Answers  


How many lines of code in each script of QTP?

0 Answers  


is it possible to operate(on/off)the capslock using qtp

2 Answers  


what are the different u notice in betweem QTP version 8.2 and 9.2 and what is new in QTP9.2

1 Answers  


When we parameterise some field ex. Textbox is there any way that we can generate a specefic number of random values (For alphabetical values if possible) instead of manually entering values in the data table

2 Answers  


Categories