Select Page
Codoid Blog

Validating Sorted WebList Values

Being a leading QA Company, we write blogs on all prominent software testing topics and tools using our real-world experience. So stay sharp by subscribing to our Newsletter.

Validating Sorted WebList. The below code excludes default selected value (i.e. –Choose One–) from validation.

Code

Dim oPage:Set oPage=Browser("name:=QTP").Page("title:=QTP")

arrCtry=Split(oPage.WebList("name:=select1").GetROProperty("all items"),";")
 
Set objArray=DotNetFactory.CreateInstance("System.Collections.ArrayList","")
 
For i=0 to Ubound(arrCtry)
If arrCtry(i)<>"--Choose One--" Then
objArray.Add(arrCtry(i))
End If
Next
 
objArray.Sort()
objArray.Insert 0,"--Choose One--"
 
For j=0 to Ubound(arrCtry)
strOuput=strOuput+objArray(j)
strOuput=strOuput+";"
Next
 
If strOuput=oPage.WebList("name:=select1").GetROProperty("all items")+";" Then
Msgbox "The Weblist's values are sorted in alphabetical order"
Else
Msgbox "The Weblist values are not sorted in alphabetical order"
End If
  

Comments(0)

Submit a Comment

Your email address will not be published.

Talk to our Experts

    Amazing clients who trust us

    image
    image
    image
    image
    image
    image