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
#2
Not Solved
Once your condition is passed then select the city name

Code:
Browser("Kotak Credit Cards – Apply").Page("Kotak Credit Cards – Apply").WebList("City1").Select(i)

Once you select the city try to retrieve city name by using proper property name like "value"

Code:
City_Name = Browser("Kotak Credit Cards – Apply").Page("Kotak Credit Cards – Apply").WebList("City1").GetROProperty("value")
Reply
#3
Not Solved
Hi,

I wanted to select a value from dropdown and my application which im trying to automate is a JAVA based one. So i tried to locate the object by its ID. I have filters for 4-Dot and 5-Dot
1) 4-Dot: VTRV say... if i enter this value the field refreshes and then i have to select the value from dropdown.
2) Then only, ill will be able to see the 5-Dot field.

Can you please help me with this.

Thanks
Sreevidya
Reply
#4
Not Solved
Hi Sreevidya,

If you have to select 2 List values, where 2nd is dependent on 1st.

Code:
Browser(".").Page("..").WebList("Listbox1").Select "Value1"
If Browser(".").Page("..").WebList("Listbox2").GetROProperty("all ietms") = ".........dependent values" Then
   Browser(".").Page("..").WebList("Listbox2").Select "whatever"
End If
Reply


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,060 12-19-2017, 10:25 PM
Last Post: sandy2404
  how to select value from google search box dropdown +QTP prajyot 0 2,898 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,673 07-20-2014, 09:40 PM
Last Post: QA_Newbie
  selecting values from the dropdown webelement poojaarora014 3 18,012 04-22-2014, 12:12 PM
Last Post: basanth27

Forum Jump:


Users browsing this thread: 1 Guest(s)