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

diff between dim & redim ? in detailed? pls any one explain me?

1 Answers  


What does VBS file contain..? what is VBS file.?

4 Answers  


hi frinds i need help .i have 4 + yrs exp in testing and nearly 2 yrs exp in QTP and QC .currently iam working north fast 2 yrs iam looking for job in south is there any openings plz letme know my mail id is pbre1980@gmail.com

0 Answers  


What is Description Object?

1 Answers  


What is meant by Pseudo Code?

5 Answers   Satyam,






how to upload an excel sheet to quality center?

1 Answers  


Can you do more than just capture and playback?

2 Answers  


Read excel using qtp descriptive programing

2 Answers   TCS,


Can we create a qtp test from qc?

0 Answers  


What is the difference between run time object and test object?

0 Answers  


Plz give the vb script for the following scenerio I have faced one issues while doing test in QTP. I have described the scenario below. 1. I have to test web application.In that i want to select from the drop down values in the application. 2. Suppose Drop down has 5 value "A,B,C,D,E".I would like to give value from data table of QTP. 3. For every iliteration it should select A,then B and so on

0 Answers  


what is reusable action and how the same can be implemented (process)?

2 Answers  


Categories