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!
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.
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)
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.
Latest posts by Admin (see all)
- SQA QTP tutorial – WebList identified as a web element and how to select an item from this list - December 9, 2015
- Automation QTP tutorial-double clicking on any object - December 4, 2015
- Software Automation QTP tutorial – 5 top reasons for using automation - November 23, 2015