Micro Focus QTP (UFT) Forums
Need help with Webelement's - 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: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Need help with Webelement's (/Thread-Need-help-with-Webelement-s)



Need help with Webelement's - Avis88 - 11-05-2010

I have a webtable with 237 rows and 15 columns. In column 2 there are only a list of 237 names but they all have webelement that has a property named HTML id. I would like QTP to run through the webelements property of each name "html id"and see if it's value has "VA" in front of it: the html id has values that looks like the following "HA123456" , "VA123456" or "GO123456" I only want it to list the names that are displayed in the webtable that has a webelement "VA" in the front of it's html id value. Is this possible QTP 9.5?


RE: Need help with Webelement's - KavitaPriyaCR - 11-08-2010

Hi Avis,

I had also faced similar scenario sometime before.I am working on version 10 Try this, i am not sure about version 9.5.
please excuse if it won't work for version 9.5,
Code:
For i= 1 To 237
   oCount=Browser().Page().WebTable().ChildItemCount(i,2,"WebElement")
   For j= 1 To oCount
    childObj=Browser().Page().WebTable().ChildItem(i,2,"WebElement",j)
    'You can use the table child object as you want here
    If (InStr(childObj.getROProperty("html id"),"VA")<>0)
     MsgBox childObj.getROProperty("html id")
    End If
   Next
Next