Random Musings

May 3, 2009

How to use ASP.NET Ajax RadComboBox with WatiN

Filed under: telerik,watin — haditeo @ 5:24 pm
Tags: ,

I am curious in how to select a valid value from the Telerik ASP.NET Ajax RadComboBox with WatiN.

First of all i googled around its forum and found this forum post. I didn’t look carefully as it was only applied to ASP.NET RadComboBox and ASP.NET Ajax RadComboBox

No wonder, after i blindly used it without modifying it, the DOM element cannot be found. Here my IE Developer Toolbar with IE 8 came to rescue

Take a look at the (a) tag inside this screenshot. In the ASP.NET RadComboBox, it was still using (image) tag


Take a look at the (li) tag for the items in the combo box. Previously it was using (div) tag


Here is the code snippet:

  // currently my RadComboBox client-id name is ddlTopic. 
  // please substitute your proper combobox name appended by "_Arrow" 
  Link radComboBoxDropDownImage = ie.Link(Find.ById("ddlTopic_Arrow")); 
  // my RadComboBox client-id name is ddlTopic 
  // please substitute with your proper combobox name appended by "_DropDown" 
  Div divTopic = ie.Div(Find.ById("ddlTopic_DropDown")); 
  ElementCollection elColl = divTopic.ElementsWithTag("li"); 
  // here i would like to select the 4th option inside the combo-box 
  // the dropdownlist option index is started with 0  

Blog at WordPress.com.