I have a dropdown list that I want to randomly choose one of the choices. However I do not want to choose the first one because it is blank (#0). Currently I have the following:
' Get the number of items from the list
cnt = Browser("Browser").Page("Page").WebList("type_of_c ontact_1").GetTOProperty("items count")
' Generate a random number in the range of 0 (first item) to cnt-1 (last item)
' Select the item using the index number
Browser("Browser").Page("Page").WebList("type_of_c ontact_1").Select "#" & type_of_contact_1
I've tried changing type_of_contact_1=RandomNumber(0,cnt-1) to type_of_contact_1=RandomNumber(1,cnt-1), but QTP will still choose the blank one randomly.
I've tried several if then loops but am having difficulty. I just want QTP to choose a different choice if the blank (#0) dropdown choice has been selected then to continue with the rest of the code. Please help.