Micro Focus QTP (UFT) Forums
Verifying the contents of a Web List in QTP scipt - 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 Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: Verifying the contents of a Web List in QTP scipt (/Thread-Verifying-the-contents-of-a-Web-List-in-QTP-scipt)



Verifying the contents of a Web List in QTP scipt - ritugoyal - 01-11-2010

Hi All,

Please can any body tell me the code in QTP(vb script) to verify the items of a Web List.

e.g. If I need to select ABC items in Web List and before selecting that item I want to verify that whether that item exist in Web List or not.

Regards,
Ritu


RE: Verifying the contents of a Web List in QTP scipt - malleshjm - 01-29-2010

Code:
listval = browser("name").Page("name).WebList("name").GetROProperty("all items")

listvalues = split(listval,";") ' u ll get all weblist values in listvalues array.

use this aray and check whether ur item is thr in the list or not

Correct if m wrong. even i am new to QTP.

Regards,
Mallesh


RE: Verifying the contents of a Web List in QTP scipt - sreekanth chilam - 01-29-2010

Hi ,

Use the below code.
Code:
Expected_Item="ABC"
  Items_count=Browser("....").Page(".....").WebList("select").GetROProperty("Items Count")
  For i=1 to Items_count
       Current_Item=Browser("....").Page(".....").WebList("select").GetItem(i)
       msgbox Current_Item
       If Current_Item=Expected_Item Then
            msgbox "expected item exists in WebList"
            Browser("....").Page(".....").WebList("select").Select Expected_Item
            Exit for
       End If
  Next



RE: Verifying the contents of a Web List in QTP scipt - moon_walker333 - 01-03-2013

You could simply do something like this:

Code:
vendorListItems = Browser("...").Page("...").WebList("...").GetROProperty("all items")
If Not instr(vendorListItems, VendorNameToSearch) > 0 Then
    Msgbox "Vendor Name not found"
End If



RE: Verifying the contents of a Web List in QTP scipt - Vijay Kumar - 10-07-2016

ExpectedResult="Sales"
ItemCount=Browser("OrangeHRM").Page("OrangeHRM_2").WebList("leaveList[cmbSubunit]").GetROProperty("all items")
itensplit=split(ItemCount,";")
For i = 1 To UBound(itensplit) Step 1
actualResult=Browser("OrangeHRM").Page("OrangeHRM_2").WebList("leaveList[cmbSubunit]").GetItem(2)
If actualResult=ExpectedResult Then
MsgBox "Elemet Found"
Browser("OrangeHRM").Page("OrangeHRM_2").WebList("leaveList[cmbSubunit]").Select "Sales"
Exit for

End If

Next