i have a simple problem i am trying to automate the testing of a website that has a lot of dropdown lists that are populated dynamically. I wish to be able to obtain all of the ID's (They populate once every day, unless a new item that was not previously in the inventory is entered.) so i can make my script target the ID to test them.

I am fairly new to this, however some info i am using Python 3.x with Selenium and Chromedriver. If you need any more info please advice and i will respond as soon as able.

Last but not least sorry for the english, not a native speaker.

Update 1: Archived if you need it please tell me and i can post it again.

Update 2: Archived if you need it please tell me and i can post it again.

Update 3: I am not sure if this is relevant (although i think it is) the drop down list is not a select list, is class is class="RadComboBoxDropDown RadComboBoxDropDown_AssetRecoverySkin which may explain why it doesn't work with the methods previously described, back to the drawing board, as soon as i have an answer i will post it.

  • Need you to show us the HTML code
    – Yu Zhang
    Dec 23, 2016 at 19:27
  • Question Updated Jan 4, 2017 at 17:43
  • You are locating elements by XPath (which is least reliable way) but using IDs in XPath. When I switched from XPath to locating by ID/name/class/CSS/text (in this order), my tests became more reliable. I usually do not even waste time to talking people off from using XPath (free country locate as you wish) and just ignore such questions but for you I made an exception :-) Jan 4, 2017 at 19:17
  • Question Updated. Fallowing your advice @PeterMasiar i changed the way i get the element, i will slowly change the way i get all my elements but for the moment is not my priority so it will be a slow process. Jan 5, 2017 at 13:43
  • You always have the option of talking to the developers and asking them if there is a particular reason for using this way of populating the dropdown rather than using for example a list. If you explain that this makes your job a lot easier and if it makes very little difference to them they might just be inclined to make the change. Testers and developers are not enemies, we're here to make nice stuff together!
    – Cronax
    Mar 8, 2017 at 16:12

1 Answer 1


Python, following it's philosophy of "batteries included", provides perfect Select() helper class:

from selenium.webdriver.support.select import Select

Select provides many useful functions, the one you want is .options() - list of the options.

This is why I love Python. :-)

  • Question Updated, i am trying to follow your advice but i am having a human error (mine) in the fact that i keep getting an error on my attempts, thank you for the idea. Jan 4, 2017 at 17:45
  • from selenium.webdriver.support.ui import Select // forgot to add this, the right address at least in python 3.x is support.ui (at least the one mentioned in the python/selenium page). Jan 5, 2017 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.