Micro Focus QTP (UFT) Forums
how to check if a value is selected in weblist - 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 Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: how to check if a value is selected in weblist (/Thread-how-to-check-if-a-value-is-selected-in-weblist)



how to check if a value is selected in weblist - Jenny - 11-17-2010

HI, i need some help on how to check if a value existed in weblist.

ie. i need to enter mulitple address for a company, i want the script can be flexible, by checking if certain address already exists then don't add. the address code is a weblist value. Please attachment


RE: how to check if a value is selected in weblist - KavitaPriyaCR - 11-17-2010

Hi Jenny
You mean if the address type "home address" already exists in the maintenance screen then don't add, else add address for home address.
If this is the case then, check the index value for each previous address types and take the index for looping:
Code:
i=0
flag=0
do While (Browser().Page().WebList("index:="&i).Exist(1))
'ObjExcelSheet.Cells(x,y).value -> is for address type
If (StrComp(Browser().Page().WebList("index:="&i).getROProperty("value"),"home address"=0) Then
' Dont add the address
flag=1
Exit do
End If
If flag=0 Then
' add the address for address type "home address"
Browser().Page().WebList("index:="&i).Select "home address"
End If



RE: how to check if a value is selected in weblist - Jenny - 11-18-2010

thank you, i will try this