Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selecting a value from a Dropdown
#1
Hi All,

I have this dropdown which is having the name of occupations. (long list)
When i try to select a value manualy i have to click the dropdown twice to load the items. On the first click, it will display an empty list. (please see the screenshot)
After sometimes it loads the items in the list. I tried to automate this in QTP. But QTP cannot select a value from it.

Any suggestions? Appreciate your help.

Thank you


Attached Files Image(s)
       
Reply
#2
A crude way, but may work.

Code:
i=0 Do oItems = browser().page().weblist().GetROProperty("items count") If oItems <> 0 then browser().page().weblist().click browser().page().weblist().select(4) Exit Do End If wait 1 i=i+1 Loop Until oItems <> 0 or i>20
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#3
Hi basanth27

Thank you for your reply. But that also doesn't work.

Any other suggestions?
Reply
#4
What happens when you execute? What is the issue you face? Does it wait till it loads?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#5
Hi,

Yes it loop through till the count is greater than 20. Issue is it will not click the the dropdown and return the item count. Sad
Reply
#6
Manually, how long does it take for the dropdown to bring up the items? I mean average secs or minutes?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#7
Hi,

Just couple of seconds, say 5. On the first click it loads the empty list and on the second click it loads the items in like 5 seconds. I have no idea why it doesnt click at runtime.
Reply
#8
Ok, Try this,

Code:
i=0 Do browser().page().weblist().Click oItems = browser().page().weblist().GetROProperty("items count") If oItems <> 0 then browser().page().weblist().click browser().page().weblist().select(4) Exit Do End If wait 1 i=i+1 Loop Until oItems <> 0 or i>20
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#9
Hi,

Isnt this same as the code you posted earlier?
Reply
#10
As you said "When i try to select a value manualy i have to click the dropdown twice to load the items."

why can't you try to click twice thru QTP only
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Different Type of Dropdown Selector zunebuggy 6 4,510 05-01-2018, 06:46 PM
Last Post: zunebuggy
  QTP not selecting appropriate webelement from the webtable..Need Solution satishkumarm 11 23,382 03-23-2016, 12:47 PM
Last Post: Swetha_Bayya
  Not able to click text inside the grid dropdown szkapoo 6 5,567 12-20-2014, 09:43 PM
Last Post: supputuri
  Selecting values from drop down using QTP. prempujaripati 2 47,606 06-26-2014, 06:06 PM
Last Post: rasmirani
  Issue related to dropdown selection(Please help urgent) excellentpawan123 2 4,920 05-31-2014, 12:00 PM
Last Post: excellentpawan123

Forum Jump:


Users browsing this thread: 1 Guest(s)