Sunday, February 3, 2013

How to select more than one item from a Listbox using QTP

We can select more than one value from any list objects like JavaList, WinList, WebList, WpfList object ect.. by using "ExtendSelect" method.

The script would like below:
If the items are selected based on Item Names,
B( ).P( ).WL( ).select "Item Name1"
B( ).P( ).WL( ).extendselect "Item Name2"

If the items are selected based on Index, then
B( ).P( ).WL( ).extendselect "#2"

How to find all the selected items from a List object
B( ).P( ).WL( "Technology").select "Java"
B( ).P( ).WL( "Technology").ExtendSelect ".NET"
B( ).P( ).WL( "Technology").ExtendSelect "Testing"

sSelectedItems=B( ).P( ).WL( "Technology").GetROProperty("selection")
 print sSelectedItems

which prints selected items as
Jave;.NET;Testing

No comments:

Post a Comment