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

in one page we have 100 links i have to click the 99th link how can i click the 99th link.

4 Answers   GK Technologies, IBM,


If I change the property value at runtime is it effect is object repository?

0 Answers  


I m new to QTP? Is it necessary to know VB for learning QTP for Automation? Can I understand QTP excellently Without practical automation?

3 Answers  


Which object repository we use in real time and can we merge 2 object repostiory and how?

3 Answers  


Differentiate the two Object Repository Types of QTP.

5 Answers  






What is the disadvantage of smart identification?

3 Answers   Infosys, Sony,


what is functions in qtp?i know the userdefind &bulit funation or i know that Private public function ?plz tell me what is funations in qtp?how to create a funation in qtp

4 Answers   NIIT,


what is the abbrivation of .mtr in action reposirtory?

8 Answers   GE,


what is the data driven testing?

0 Answers  


How to create runtime property for an object?

0 Answers  


Is QTP supports Unix. If yes, then how the test automation is done?

0 Answers   iFlex,


how can i call an external action,which is not added external action of an action?

2 Answers   Ordain Solutions,


Categories