I have 3 columns in a table.
The First Row of Column1 and Column2 have data and third column does not have any data.
Brw.Pge.WebTable(XYZ).ColumnCount(1) returns 2 as column count. It should return 3.
Any work around for this?
This is a bug in QTP. It should count ALL columns in a table regardless of data is populated or not.
Check if column 1 is being returned as column 0...the count may start from 0.
Try .GetCellData (1, 3) and see if it returns something?. Should be blank at least.
What appears to you on the UI may not be whats underneath. Tables can have hidden columns or merged columns. What you view from your naked eyes is not what you get in this case. You need to look into the HTML source code of the web page to make sure
Buy the NEW QTP Descriptive Programming Unplugged Book
** Download QTP Unplugged 2nd Edition eBook for FREE **
Try to use GetROProperty("Cols"), check the number of columns.
Winds of Change
Thanks Ganesh, I have implemented a solution based your feedback and it works.