Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Verifying the contents of a Web List in QTP scipt
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
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
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
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
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
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
Reply
#4
Solved: 10 Years, 8 Months, 3 Weeks ago
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
Reply
#5
Solved: 10 Years, 8 Months, 3 Weeks ago
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to clear the contents of datatable(Local or Global sheet) during runtime? srinibarati 3 13,006 11-27-2016, 10:10 PM
Last Post: EbbyNader
  create drop Down list or menu in qtp abansal 0 3,709 09-07-2012, 05:36 PM
Last Post: abansal
  QTP 11 Patches List Till date supputuri 0 9,518 12-02-2011, 10:23 PM
Last Post: supputuri
  Verifying checkpoint and set flag ritugoyal 3 6,025 01-18-2010, 06:38 PM
Last Post: ritugoyal
  Java List not being identified by QTP aditi 7 9,733 08-21-2009, 04:17 AM
Last Post: aditi

Forum Jump:


Users browsing this thread: 1 Guest(s)