5 Answers, 1 is accepted
Do you mean you need to check if the combobox contains an item with specific text or if the text of the combobox (the item you already picked) matches some value? Also we need to know the exact component you're automating. Is that RadComboBox or MS one? Is that ASP.NET or Silverlight ComboBox?
the Telerik team
I need to check if combobox contains an item with specific text.
And the combobox is Silverlight combobox and is recognized as IcUserTypesCombobox(if this is of any help).
Please let me know if I answered your question
This sort of verification must be done using a coded step. In the coded step you must follow these steps:
Fetch the list of items contained in the combobox
Scan through the list looking for a string match on the item
The code will look like this:
Also due to the nature of how Silverlight works, you must open the combobox just once before you will get the list of items attached to it. Silverlight doesn't actually add the items to the combobox until it actually needs to display them.
I've attached a sample test against the MSDN Silverlight control demo page that demonstrates verifying the combobox contains a certain text item.
I want to verify elements of dropdown list contains specific text
for this i am identifying drop down element via xpath in coded step.
Element dropDown = Find.Byxpath("//input[@id='dropDown_select_locator']")
What is the coded step to fetch all ts list elements and save it in list.
I want to fetch all dropdown list options and save it in iList.
Based on the shared details I assume that toggling the dropdown triggers the appearance of the list with items in the DOM tree. Probably this is a HTMLUnorderedList which items can be easily accessed and used in a foreach cycle. The foreach statement should be built similarly to the example how to iterate through each grid cell.
Please keep in mind that if the list appears dynamically in the DOM tree, you will need to refresh that in the code as well. That way you will ensure that the Testing Framework has its latest state.
I hope the above helps. Still, if it doesn't. or the information is insufficient to find the proper solution, please prepare a sample test against an accessible page to demonstrate what difficulties you are facing.
Test Studio Trainings