Micro Focus QTP (UFT) Forums
Getting WebTable Count - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Getting WebTable Count (/Thread-Getting-WebTable-Count)



Getting WebTable Count - akapoor - 03-21-2011

Hello All,

I am quite new to QTP. The question that I have is, if I have like 100 webtables in a page/frame, and I want to get the total count of these webtable via code, how to do accomplish that?

My goal is to iterate over all the webtables, and for each webtable, I want to print the data (I am just trying to simplify the task for now).


In other words,
Code:
totalWebTables = Browser("").Page("").Frame("").WebTable.GetCount(???)

for i = 1 to totalWebTables

msgbox Browser("").Page("").Frame("").WebTable(i).RowCount
Next

Thanks. Kindly let me know if this doable.

AKapoor


RE: Getting WebTable Count - basanth27 - 03-21-2011

You will have to get the frame's childobjects as the webtable. Learn more about childobjects method. Search this forum and you will slide through.


RE: Getting WebTable Count - akapoor - 03-21-2011

Thanks for your reply. Webtables are already frame's childobjects. But I am still not too sure, as to how to get this to work.


RE: Getting WebTable Count - basanth27 - 03-21-2011

Since you are not intrested to search and learn, i will logically guide you till the tunnel and then let you survive Smile

Try this,
Code:
Set oWebtable = Description.Create()
oWebtable("micclass") = "Webtable"
oWebtable("html id") = "spy and enter the html id"

Set oChildObjects = Browser("").Page("").Frame("").ChildObjects(oWebtable)
msgbox oChildObjects.count