Webtable in QTP

You might also like

You are on page 1of 2

webtable in QTP

How to handle webtable in QTP Its very easy to automate webtable in QTP. Just You will require following knowledge to automate webtable. 1. How to get row count from webtable? 2. How to get column count from webtable? 3. How to fetch data from specific row and column from webtable? Method to get row count and column count from webtable You can use rowcount method to get data from specific row and specific column. Refer following step by step procedure to apply getcelldata method in your script. Steps:1. First record the table using QTP.(just click on any element of webtable) 2. After recording you will get code like following. Browser ("myBrowser").Page ("myPage").Frame ("myFrame").WebTable ("myTable").WebElement(myElement) 3. Now just remove webelment part from above sentence and write rowcount (after .) at the end of sentence, so you will have code like following. Dim Row_Count Row_count = (Browser ("myBrowser").Page ("myPage").Frame ("myFrame").WebTable ("myTable").RowCount) 4. you will get row count in Row_count variable. Note:- The same apply for getting column count but just you have to specify no. of row in argument. Following code will give column count of 2nd row. e.g.

Row_count = (Browser ("myBrowser").Page ("myPage").Frame ("myFrame").WebTable ("myTable").Columncount(2)) Method to fetch data from specific row and column from webtable. The same method applies here as above in row and column count. We can fetch value from table using getcelldata method. Here two argument have to specify to fetch value. The following code will get data from 3rd row and 5th column. The first argument must be row and second must column. e.g. Get_data = Browser ("Cisco Media Experience_4").Page ("Cisco Media Experience_3").Frame ("Frame_3").WebTable ("Job ID_2").GetCellData (3, 5) If you face any difficulty to get content of webtable you are always welcome to raise query.

You might also like