Working with Web Table in QTP

Tables are one of the primary design tools for developing Web Application. Web table object containing number of rows and columns apart from these by using web table we can design sidebars, framing images, navigation bars, titles like we can use web table objects. When we are working with Descriptive Programing using QTP, Web table object is very useful to get data for further activities. A Table containing a number of rows and columns. A Table containing any kind of information in cells in combinations of rows and columns.
        
   

In web table we having some properties to do some actions in excel. The properties are
a) RowCount
b) ColumnCount
c) GetCellData

a) RowCount: By using this method we can get the RowCount (Total number of Rows used in Excel)
Example Script:
Write a Descriptive Program to get the number of rows used in Excel:
Set MyTable=Browser ("Gmail: Email from Google").Page ("Gmail - Inbox").Web Table ("html tag: =TABLE","name: =t",” X: =173”)
RC=MyTable.RowCount
Msgbox RC


                                                            (Or)

Set MyTable=Browser ("Gmail: Email from Google").Page ("Gmail - Inbox").Web Table ("html tag: =TABLE","name: =t",” X: =173”).RowCount
RC=MyTable
Msgbox RC

b) ColumnCount: By using this method we can get how many columns are used in particular Row

Syntax: ColumnCount (Row)
Write a Descriptive Program to get the number of Columns used in Particular Row
Set MyTable=Browser ("Gmail: Email from Google").Page ("Gmail - Inbox").Web Table ("html tag: =TABLE","name: =t",” X: =173”)
CC=MyTable. ColumnCount (3)
Msgbox CC


                                                            (Or)

Set MyTable=Browser ("Gmail: Email from Google").Page ("Gmail - Inbox").Web Table ("html tag: =TABLE","name: =t",” X: =173”) .ColumnCount (3)
CC=MyTable
Msgbox CC


c) GetCellData: By using this method we can get particular cell data

Syntax: ColumnCount (Row no, Column no)

Write a Descriptive Program to get the Particular Cell data:
Set MyTable=Browser ("Gmail: Email from Google").Page ("Gmail - Inbox").Web Table ("html tag: =TABLE","name: =t",” X: =173”)
GD=MyTable. GetCellData (2, 3)
Msgbox GD


                                                            (Or)

Set MyTable=Browser ("Gmail: Email from Google").Page ("Gmail - Inbox").Web Table ("html tag: =TABLE","name: =t",” X: =173”). GetCellData (2, 3)
GD=MyTable
Msgbox GD