Micro Focus QTP (UFT) Forums
Selecting a value from a Dropdown - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Selecting a value from a Dropdown (/Thread-Selecting-a-value-from-a-Dropdown)

Pages: 1 2


Selecting a value from a Dropdown - qtpbeginner78 - 06-06-2013

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


RE: Selecting a value from a Dropdown - basanth27 - 06-06-2013

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



RE: Selecting a value from a Dropdown - qtpbeginner78 - 06-06-2013

Hi basanth27

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

Any other suggestions?


RE: Selecting a value from a Dropdown - basanth27 - 06-06-2013

What happens when you execute? What is the issue you face? Does it wait till it loads?


RE: Selecting a value from a Dropdown - qtpbeginner78 - 06-06-2013

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


RE: Selecting a value from a Dropdown - basanth27 - 06-06-2013

Manually, how long does it take for the dropdown to bring up the items? I mean average secs or minutes?


RE: Selecting a value from a Dropdown - qtpbeginner78 - 06-07-2013

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.


RE: Selecting a value from a Dropdown - basanth27 - 06-07-2013

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



RE: Selecting a value from a Dropdown - qtpbeginner78 - 06-07-2013

Hi,

Isnt this same as the code you posted earlier?


RE: Selecting a value from a Dropdown - ssvali - 06-07-2013

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