RadComboBox problems

4 posts, 0 answers
  1. Andrea
    Andrea avatar
    16 posts
    Member since:
    Jul 2012

    Posted 14 Aug 2013 Link to this post

    Hi,

    I am creating a smoke test and seeing some behavior with the RadComboboxs. I need to automate one being opened. Is there a recommended way to do this?

    I've tried ToggleDropDown but on occasion I get 'Object reference not set to an instance of an object' originating from Telerik.WebAii.Controls.Xaml.Wpf.RadComboBox.ToggleDropDown().

    I've also tried trying if the combobox has items and then doing SelectItem(0, true) but, this gives me the following error when it tries to automate on a combobox from the filter popups on the grids.

    System.Exception: Was not able to match a segment within the path. Expected:decorator , Found:FrameworkElement , Path:/popuproot:-1:11962631/decorator:0:40554822/nonlogicaladornerdecorator:0:29449080/contentcontrol:0:29534370/contentpresenter:0:23828523/filteringcontrol:0:13130117/border:0:51062193/grid:0:56906561/stackpanel:0:42397005/stackpanel:1:20897776/radcombobox:3:29186801
       at ArtOfTest.WebAii.Silverlight.VisualFind.ByReference(AutomationReference reference, Boolean throwIfNotFound)
       at ArtOfTest.WebAii.Silverlight.FrameworkElement.Refresh()
       at Telerik.WebAii.Controls.Xaml.Wpf.RadComboBox.ToggleDropDownIfRequested(Boolean openDropDown)
       at Telerik.WebAii.Controls.Xaml.Wpf.RadComboBox.SelectItem(Int32 itemIndex, Boolean openDropDown)
       at Telerik.WebAii.Controls.Xaml.Wpf.RadComboBox.SelectItem(Int32 itemIndex)

    Any ideas?

    I'm using version 2012.2.1527.0.
    Thanks
    Andrea
  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 19 Aug 2013 Link to this post

    Hello Andrea,

    Thank you for contacting us.

    What exactly do you want to automate? Do you want to verify some elements in the drop down or do you want to select some of them. Do you want to verify that the dropdown is open? 

    The first thing you can try is to add a WaitForExists step for that drop down. Note that you should set the timeout in the brackets (e.g. elelment.WaitForExists(100000);).\

    If the drop down is using Ajax request you should wait for it also:

    ActiveBrowser.WaitForAjax(30000);

    Try this out and let us know the results.

    Hope to hear from you soon.

    Regards,
    Boyan Boev
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  3. Andrea
    Andrea avatar
    16 posts
    Member since:
    Jul 2012

    Posted 19 Aug 2013 Link to this post

    Hi,

    I need to open the drop down and select one of them. So far, I can only get it to open the drop down reliably using:

      if (comboBox != null && comboBox.HasItems) {
    comboBox.AllowDrop = true;
    if (comboBox.DropDownButton != null) {
      comboBox.DropDownButton.User.Click();
    }
    }

    I tried adding in a Wait.ForExists after the drop down has been opened. I then tried to select an item using SelectItem(index). This works the majority of the time, but causes the unsightly error I previously provided when it attempts to do this from the filter popup on the grid.

    Thanks,
    Andrea
  4. Boyan Boev
    Admin
    Boyan Boev avatar
    1045 posts

    Posted 22 Aug 2013 Link to this post

    Hello Andrea,

    Please try out this code:

    Pages.TelerikComboBoxFor.SilverlightApp.TechnologySelectionRadcombobox.Wait.ForExists(30000);
    Pages.TelerikComboBoxFor.SilverlightApp.TechnologySelectionRadcombobox.ToggleDropDown();
    ActiveBrowser.WaitForAjax(30000);
    Pages.TelerikComboBoxFor.SilverlightApp.TechnologySelectionRadcombobox.SelectItem("ASP.NET", false);

    This is a simple demo against our Silverlight demo site

    Hope this helps.

    Regards,
    Boyan Boev
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top