Quality Testing

Quality is delighting customers

A list box has values Select, 1, 2, 3, 4, 5

While recording in QTP i selected value 2.

If i want to check which value I have selected, how can I do it in QTP?

I want to check the value of selected item in list.

Views: 8343

Reply to This

Replies to This Discussion

go for Descriptive programming in QTP, you can pick the values dynamically which value you want.

first you need to count for all vaues using childObjects() method then use count() method now you can count the how many values from drop down.



Use the "GetSelection" method.


Best Regards,




Tried this. The code is as follows

var_selected=Browser("Welcome To appname").Page("app_40").WebList("lst_listbox1").GetSelection

For this step, I get the error - Object doesn't support this property or method.

Anything wrong in this line?

Hi Ashutosh,

Actually "GetSelection" doesn't support Weblist, i thought it was a SwfList. For Weblist you can use "GetROProperty".

var_selected=Browser("Welcome To appname").Page("app_40").WebList("lst_listbox1").GetROProperty("value")


Please let me know if you need further help on this.....


Best Regards,



Hi Bibin.

It worked...!!

Thank you very much

You are welcome......

Plz note that instead of value you can also use selection, i.e GetROProperty("selection")


Best Regards,



just count the whole values and pass it into one variable..

then msgbox "that variable"

like for i=.....rowcount

msgbox i







I do not want to retrieve all the values one by one.

While recording, 1 value is already selected.

When a test is run, each time I want to display the selected item in the list. Again the value does not change dynamically. It is same at each run.

Eg, while recording, if I select value 3 from list box, while running test I want this value to be displayed. What property/method shall I use for this?

can u send the code if possible thn i can easily help u ..

if u write msg box..with in a loop thn it wil show u..the value..



TTWT Magazine





© 2021   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service