Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to match weblist data with expected values
#6
Solved: 6 Years, 6 Months ago
Store both the lists as dictionary and then use this function to compare the two dictionaries. This is the most optimum method to compare two lists in VB Script. 
Code:
Function CompareArrays(array1, array2)

       'Do they have the same number of items?
       If array1.Count <> array2.Count Then
           CompareArrays = False
           Exit Function
       End If

       'Compare keys and values
       For Each Key in array1.Keys

               'Check Keys
               If NOT(array2.Exists(Key)) Then
                   CompareArrays = False
                   Exit Function
               End If

               'Check Value
               If array1.Item(Key) <> array2.Item(Key) Then
                   CompareArrays = False
                   Exit Function
               End If
       Next

       CompareArrays = True

 End Function

Code Source
A second method can be to use arrays and then using two loops compare the values of those arrays one by one (but it is not as optimized as the method above.)
Want to fast track your QTP/UFT Learning? Join our UFT Training Course
Reply


Messages In This Thread
RE: How to match weblist data with expected values - by Ankur - 05-18-2018, 12:15 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Unable to select value from Weblist using QTP neenumaria 4 13,190 08-07-2018, 04:43 PM
Last Post: NovGirl
  finding expected value in webtable Anupama 8 2,900 05-23-2018, 06:20 PM
Last Post: Anupama
  WebElement (only Weblist) is not getting identified in QTP 11, Windows 7 priyaang 3 5,927 06-26-2015, 12:39 AM
Last Post: supputuri
  Application Issue on selecting value from weblist using UFT 12.1 on run sunilkgupta 0 2,282 01-01-2015, 08:22 PM
Last Post: sunilkgupta
  get visible cell data values from webtable Satwik 1 4,532 07-24-2014, 11:57 PM
Last Post: supputuri

Forum Jump:


Users browsing this thread: 2 Guest(s)