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 open a new test using quicktest professional (qtp)?

0 Answers  


Can we record a video in qtp recording??

1 Answers   BirlaSoft,


What r types of parametarizations?

6 Answers  


Hi How to retrieve data from web element line by line?

0 Answers  


what is retesting?

2 Answers  






How many types of recording facility are available in quicktest professional?

0 Answers  


How to swap two numbers by using parameter passing method byref in a fucntion and return the result to outside of the function?

1 Answers   CTS, IBM, London,


Hi, actually I completed Btech(CS). But i Will go to admin (Facility) interview. So, If Interviewer asking like " Why You choose this field". What we say? pLZ PLZ PLZ PLZ >............................................Send me.....

2 Answers  


what type automation is fofollowed in the project?

1 Answers   Satyam,


If 3 browsers are opened in our system, how to enter the facebook url into second browser by using descriptive programing

3 Answers   Mind Tree,


What is the exact difference between QTP and RFT ?

2 Answers   CTS,


what is stlc and its contents?

1 Answers  


Categories