webtable in QTP

By | June 19, 2009

How to handle webtable in QTP

Hi Friends,
I should describe this post in very beginning of this blog anyway Today I am going to describe some basic things to handle webtable in webpage automation using 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.


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.

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.

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.

If you like this article, You can subscribe through mail.

19 thoughts on “webtable in QTP

  1. Anonymous

    I want to get number of rows in a web table, but i am not able to do so..
    Here is what i am doing
    Set obj_webtbl = Browser(“Browser”).Page(“Priority Club Rewards”).WebTable(“InterContinental® Hotels”)
    Set Var_row = obj_webtbl.RowCount

    its giving me error in the var_row line that, please help.

  2. qtp-fan

    Please follow step by step process given in this post.
    1.First click on any element of webtable.

    2.Then you will get recorded sentense like following.
    Browser(“Browser”).Page(“Priority Club Rewards”).WebTable(“InterContinental® Hotels”).webelement(“xyz”)

    3.Then remove webelement and put rowcount instead of it.

    So you will have following sentence,
    RowCont=(Browser(“Browser”).Page(“Priority Club Rewards”).WebTable(“InterContinental® Hotels”).rowcount)

    Please try this procedur and let me know.

  3. sri

    I was not able to record a webtable..
    Ex : I have one webtable and some links and text in that table.. if I click on a link while recording , record steps are not showing webtable..
    it just showing B.P.Click(link)

  4. Neelkanth

    Hi Sri,
    Following solutions that I can think of,
    1. In which language your application is developed?? If QTP doesn’t support it then You need to install add-in in QTP.
    2. Try to Open first QTP then your application and then try recording of webtable.

    Let me know if require further help..

  5. Anonymous

    thank u so much ,i faced this ques,now i got ans,u r decribed very clearly

  6. Anonymous


    This is a good solution from you…but what if the table is divided in to multiple tables like in the following scenario:
    Suppose a table has 4 columns and multiple rows, each row under the columns is again divided in to table then how can we automate it???

  7. Anonymous

    Can you describe your question in more detail or give me any example, so that I can help you. But you should try “Object Spy in QTP”. Using this method you can easily identify/understand each object structure. Its really great tool in QTP. Let me know if you face any difficulty.
    – QTP Lover

  8. shyam

    after ordinal identifier. still not identify object then wht will u do..

  9. Anonymous

    Can You explain the difference between childitem and childobjects ?

  10. Anonymous


    Thanks for Providing valuable information.

    Small clarification, to retrieve number specific to condition from web table.


    I would like to know first name, last name and email address for specific city as ‘Bangalore’ from web table where it has first name, last name, email address and City in that case how i need to use the script.

    Thanks for your support in Advance.

  11. Anonymous

    in DataTable i have 10 records of about 10 to 15 columns lest say an example.

    now i want to get alternative records with all columns.

    pls answer any budy

  12. verni

    I want to retrieve 3rd and 4th coloumn data for each row in a web table.Please guide.

    The code u have specified above is to get 3 and 4th coloumn data for one row for each row how it will be done.

  13. smaz


    can anyone help me for the following task in QTP

    1- I have application which have many nested table on a page.
    2- let say under A table which is parent table has B Table which is child of A and then B has one more table which is child of B, So I need to click the object which is reside under B and then to the next page which is associate with B
    3- Similarly I have may B Table on a page and I have to iterate until it get the last B under A..
    I hope that is enough to make it understand if not then I will be open on Skype 24/4 and here is my id to chat you and explain you more..

  14. Ramakrishna

    Hi Neelkanth,

    In a webtable there are set of rows and cloumns, in which the cells are displayed in hidden. In that one cell contains link name called some “XXXXXX”

    I want to get that particular link name and click on it.. If we click on that link it will navigate to the next page. In that page we will have no of check boxes which are displayed in enable and disable mode…

    Want retrieve those check boxes

    Here want to get both link name and check box names in an excel file.

    Plz help me how to write the code for the entire scenario….

    Thanks in Advance


Leave a Reply

Your email address will not be published. Required fields are marked *