Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to select a city from the dropdown
#1
Not Solved
Hi Ankur,

I have a doubt for my code -- To select a city from the dropdown using VB script in QTP

Suppose if i want to select Noida from the dropdown list , using object spy i see the selected_item_index=13
and after selecting the city it must be displayed in a msgbox .. what should be the correct code -

The first half shows the total items present in the list and if Noida is present or not.
The second half as expected must select the city Noida and display in msgbox which is not working .

Code:
city_found = "City Not Found"
total_item_list = Browser("Kotak Credit Cards – Apply").Page("Kotak Credit Cards – Apply").WebList("City1").GetROProperty ("items count")
Msgbox total_item_list
For i = 1 To total_item_list
city_name = Browser("Kotak Credit Cards – Apply").Page("Kotak Credit Cards – Apply").WebList("City1").GetItem (i)
    If city_name = "Noida" Then
        Msgbox "Pass"
        city_found = "City Found"
        Exit For
    End If
Next
Msgbox city_found


selected_city=Browser("Kotak Credit Cards – Apply").Page("Kotak Credit Cards – Apply").WebList("City1").GetROProperty ("selected_item_index")
Msgbox selected_city
Reply


Messages In This Thread
How to select a city from the dropdown - by yash - 09-10-2013, 03:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Sad How To Find Dropdown Object based on Values from the dropdown list mesg2anil 12 34,043 12-19-2017, 10:25 PM
Last Post: sandy2404
  how to select value from google search box dropdown +QTP prajyot 0 2,897 06-28-2017, 06:30 PM
Last Post: prajyot
  Problem selecting in a dropdown menu during playback. qemls29 9 13,029 07-28-2015, 05:44 PM
Last Post: Sharan
  How to select dynamic checkbox from web dropdown QA_Newbie 2 4,666 07-20-2014, 09:40 PM
Last Post: QA_Newbie
  selecting values from the dropdown webelement poojaarora014 3 18,011 04-22-2014, 12:12 PM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)