I'm attempting to use a coded step to do a series of actions, including selecting an item from a silverlight radcombobox. I can record/playback this exact scenario without any problems, but when I attempt to do the exact same thing through code I get the following error:
Error:
System.ArgumentException: ComboBox contains no items to search in and select! Please make sure the test case opens the drop down first.
Code Snippet #1 that caused error:
comboBox.SelectItem("TEST", true); //this should both open and select the TEST item from the comobox
Code Snippet #2 attempting to workaround, the same error is triggered:
comboBox.User.Click(); //Open combobox manually
System.Threading.Thread.Sleep(5000); //Manual wait, just in case it was a speed issue
comboBox.SelectItem("TEST", false); //select the TEST item from an open combobox
Code Snippet #3 attempting to workaround, no error is triggered as the foreach is skipped because there are zero items found:
comboBox.User.Click(); //Open combobox manually
System.Threading.Thread.Sleep(5000); //Manual wait, just in case it was a speed issue
foreach (Telerik.WebAii.Controls.Xaml.RadComboBoxItem rcbi in comboBox.ItemElements) //attempting to loop through all items in combobox
{
if (rcbi.ToString() == "TEST")
{
rcbi.User.Click();
}
}
Copied from DOM:
<radcombobox Name="comboBox" AutomationId="comboBox" Uid="30481338">
<grid Name="VisualRoot" Uid="3226344">
<border Uid="16841414" />
<radtogglebutton Name="PART_DropDownButton" AutomationId="PART_DropDownButton" Uid="33647865">
</radtogglebutton>
<validationtooltip Name="ValidationTooltip" BaseType="Control" Uid="34395333" />
<popup Name="PART_Popup" AutomationId="PART_Popup" Uid="45097725">
<grid Name="PopupRoot" Uid="43140557">
<shadowchrome BaseType="Control" Uid="41122544">
<border Name="PART_ResizeBorder" Uid="27380479">
<grid Uid="47781518">
<radbutton Name="PART_ClearButton" AutomationId="PART_ClearButton" Uid="34558579" />
<scrollviewer Name="PART_ScrollViewer" AutomationId="PART_ScrollViewer" Uid="42591759">
<border Uid="65381771">
<grid Uid="14721181">
<scrollcontentpresenter Name="ScrollContentPresenter" Uid="10290070">
<itemspresenter Uid="51565033">
<stackpanel Uid="61432121">
<radcomboboxitem Uid="16018178">
<border Uid="309837">
<grid Uid="51795644">
<border Name="HighlightVisual" Uid="21433500">
<border Uid="58683773" />
</border>
<contentpresenter Name="Content" Uid="63507614">
<grid Uid="43843091">
<textblock Uid="34697616">TEST</textblock>
Am I missing something?
Error:
System.ArgumentException: ComboBox contains no items to search in and select! Please make sure the test case opens the drop down first.
Code Snippet #1 that caused error:
comboBox.SelectItem("TEST", true); //this should both open and select the TEST item from the comobox
Code Snippet #2 attempting to workaround, the same error is triggered:
comboBox.User.Click(); //Open combobox manually
System.Threading.Thread.Sleep(5000); //Manual wait, just in case it was a speed issue
comboBox.SelectItem("TEST", false); //select the TEST item from an open combobox
Code Snippet #3 attempting to workaround, no error is triggered as the foreach is skipped because there are zero items found:
comboBox.User.Click(); //Open combobox manually
System.Threading.Thread.Sleep(5000); //Manual wait, just in case it was a speed issue
foreach (Telerik.WebAii.Controls.Xaml.RadComboBoxItem rcbi in comboBox.ItemElements) //attempting to loop through all items in combobox
{
if (rcbi.ToString() == "TEST")
{
rcbi.User.Click();
}
}
Copied from DOM:
<radcombobox Name="comboBox" AutomationId="comboBox" Uid="30481338">
<grid Name="VisualRoot" Uid="3226344">
<border Uid="16841414" />
<radtogglebutton Name="PART_DropDownButton" AutomationId="PART_DropDownButton" Uid="33647865">
</radtogglebutton>
<validationtooltip Name="ValidationTooltip" BaseType="Control" Uid="34395333" />
<popup Name="PART_Popup" AutomationId="PART_Popup" Uid="45097725">
<grid Name="PopupRoot" Uid="43140557">
<shadowchrome BaseType="Control" Uid="41122544">
<border Name="PART_ResizeBorder" Uid="27380479">
<grid Uid="47781518">
<radbutton Name="PART_ClearButton" AutomationId="PART_ClearButton" Uid="34558579" />
<scrollviewer Name="PART_ScrollViewer" AutomationId="PART_ScrollViewer" Uid="42591759">
<border Uid="65381771">
<grid Uid="14721181">
<scrollcontentpresenter Name="ScrollContentPresenter" Uid="10290070">
<itemspresenter Uid="51565033">
<stackpanel Uid="61432121">
<radcomboboxitem Uid="16018178">
<border Uid="309837">
<grid Uid="51795644">
<border Name="HighlightVisual" Uid="21433500">
<border Uid="58683773" />
</border>
<contentpresenter Name="Content" Uid="63507614">
<grid Uid="43843091">
<textblock Uid="34697616">TEST</textblock>
Am I missing something?