QTP/UFT tutorial: A Quick and easy tutorial for getting the value of a cell in a data table from a web application

Hi. Today I will should you how to pull a specific value out of a data table in a web application! As usual, I created a practice table for you below. Before we start, close all other browser and windows except for this window. For quickness and simplicity of this tutorial, my code is currently set up for 1 window and 1 browser.  Let's get started!

Value1 Value2
Value3 Value4

Let's pull Value4 from the table.

1. Click on the object spy and choose value4 in the table

2. Click on the webtable in the hierarchy and use the unique property text value to identify the web table.


3. Next, we want to pull the value from particular cells in that cell value. Look at your webtable object in the object spy. It gives you the row and column for the object you chose. We can now use this to identify the specific cell value.

Browser("Index:=0").Page("title:=.*").WebTable("text:=Value1Value2Value3Value4").GetCellData(2, 2)

4. Now set the object to a variable and use msgbox to make sure you print that variable correctly.

varCellValue4 = Browser("Index:=0").Page("title:=.*").WebTable("text:=Value1Value2Value3Value4").GetCellData(2, 2)
MsgBox varCellValue4

Awesome right? This way of retrieving data from an app is great when the structure of the table stays static. Let me know if you have any comments or questions.

Pin It on Pinterest

Clef two-factor authentication