Micro Focus QTP (UFT) Forums

Full Version: How to count no of Webelement in a WebTable?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi There,

I couldn't able to find no of Webelements present in a WebTable using childobjects and Getroproperty methods
--The specific WebTable contains 43 objects...and there are many webElements but it returns 0....Any idea where I am making mistake.

Code:
Set oWT= Description.Create()
     oWT("html tag").value = "TABLE"
     oWT("INDEX").value = 2

set objs= Browser("creationtime:=0").page("title:=.*").WebTable(oWT).childobjects
cnt = objs.count

    c=0
    For i = 0 to cnt-1
      If  objs(i).getroproperty("micClass") = "WebElement " then
      c = c+1
      end if
    Next
    msgbox "Print no of Weblemetns are " &c
The problem is in the "WebElement ". It should be "WebElement". The extra space is a killer. I tried your code without the space and it worked perfectly

Parke