Combo Box's Items property return zero

Class library usage, coding and language questions.
Posts: 4
Joined: Fri Jun 21, 2013 11:49 am

Combo Box's Items property return zero

Post by batabek » Mon Apr 14, 2014 1:56 pm

I am trying to get the list items contained in a combo box. I am using the combo box class' Items property to get a list but its count always returns zero and unable to find items in it. How can I solve this issue?

User avatar
Ranorex Guru
Ranorex Guru
Posts: 7072
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Combo Box's Items property return zero

Post by odklizec » Mon Apr 14, 2014 2:39 pm


It's hard to say what's wrong without knowing more about the combo box. Could you please post a Ranorex snapshot created with the problematic combo box?

Here you can learn how to create such snapshot file... ... files.html
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

Posts: 137
Joined: Fri Apr 06, 2012 12:19 pm

Re: Combo Box's Items property return zero

Post by mzperix » Tue Apr 15, 2014 8:44 am

Hi babatek,

I have some wild guesses :)

Combo boxes are always a challenge to automate. Here is are some tips to consider automating it:

1. In order to acces the listitems, first you HAVE to click on the combo box. It is because sometimes the listitems appear as a new form on the page, and you have to activate it. After clicking the combobox, the elements become visible, and hopefully you will be able to use the count. Make note, that after clicking on the combobox, the listitems CAN appear in a DIFFERENT control, and not in what you expect based on the SPY dom. It is mostly beacuse of how the list is implemented. Even the different browsers use different methods to handle listitems :)
2. If you want to use SPY to identify the listitems: click on Track button, then press F12 to stop tracking, click on the combobox, then release F12 to continue tracking elements.
3. If you want to select an element from the list, there are two common ways to achieve this, if clicking is not working (due to not seen on screen):
a) if the control enables it, then just type the element name
b) use the down button, read the value of selected item, if it is what you want, press enter, else go down again.

But the best would be if you could share some more information on the technology you use (web based, which browser, WPF application, etc.), and if you can, make a snapshot from the combobox, and also from the active listitems.

Best regards,
Zoltán Major