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
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
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
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