RadComboBox SelectItem fails with long lists

8 posts, 0 answers
  1. Joel
    Joel avatar
    11 posts
    Member since:
    Dec 2010

    Posted 09 Feb 2011 Link to this post

    I am attempting to select an item from a RadComboBox using the WebAii testing framework.  The combo box contains a list of state names where the drop down list is big enough to show 7 states at a time.  The following code is attempting to select "Wisconsin" from the combo box (radComboBox is an instance of RadComboBox in Telerik.WebAii.Controls.Xaml).
    • radComboBox.SelectItem("Wisconsin");
    And is generating the following exception:
    • System.InvalidOperationException: Point (2220, 1624) outside bounds of browser window: (1797, 194, 1073, 717)
    With the following stack trace:
    • ArtOfTest.WebAii.Silverlight.UserInteraction.ValidateMouseLocationIfNeeded(Point point)
    • ArtOfTest.WebAii.Silverlight.UserInteraction.Click(MouseClickType clickType, Point offsetPoint, OffsetReference reference)
    • Telerik.WebAii.Controls.Xaml.RadComboBox.SelectItem(String itemText, Boolean openDropDown)
    • Telerik.WebAii.Controls.Xaml.RadComboBox.SelectItem(String itemText)
    • <my call to SelectItem>
    This same call will work for other combo boxes where the list contains 7 items or less.  Any clues for getting this to work would be greatly appreciated.  Thanks.

    Joel
  2. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 09 Feb 2011 Link to this post

    Hi Joel,

    I am going to guess that at the time it is trying to select the item, it's not current visible on the screen, correct? Can you try adding some code to scroll the list until the item you want to select is visible before selecting it?

    All the best,
    Cody
    the Telerik team
    Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
  3. Joel
    Joel avatar
    11 posts
    Member since:
    Dec 2010

    Posted 10 Feb 2011 Link to this post

    Hi Cody,

    You are correct.  After digging around a little, I found that this little piece of code fixes my problem.  It finds the RadComboBoxItem I want to select based on selectionArg, calls EnsureClickable on that item and then selects it.

     

     

    RadComboBoxItem item = radComboBox.Items.FirstOrDefault(x => x.Text.Equals(selectionArg));
    item.EnsureClickable();
    item.Select();

    Thanks.

    Joel

     

  4. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 10 Feb 2011 Link to this post

    Hi Joel,

    That is great news! I very much appreciate the update letting us know exactly how you resolved this problem. As a result of this we are going to look into adding EnsureClickable to the Select function so our other customers don't run into the same problem. In fact I've granted you 800 Telerik points for pointing out to us such an excellent find.

    Thank you,
    Cody
    the Telerik team
    Interested in Agile Testing? Check out Telerik TV for a recording of Automated Testing in the Agile Environment
  5. ABdul
    ABdul avatar
    1 posts
    Member since:
    Sep 2011

    Posted 08 Sep 2012 Link to this post

    Where do you put this code. I am trying to select Country from the countries list and running into the same problem.
  6. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 10 Sep 2012 Link to this post

    Hi ABdul,

    Are you using Test Studio and creating a Test Studio type test or are you using the Telerik Testing Framework and manually creating a 100% coded unit test? If you're using Test Studio you want to add a coded step right after opening the drop down of the combobox. Then add this code into the coded step.

    All the best,
    Cody
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  7. Adi
    Adi avatar
    2 posts
    Member since:
    Apr 2013

    Posted 30 May 2013 Link to this post

    i added the same code

    RadComboBox radComboBox = Pages.SapiensDecision1.SilverlightApp.AnimatedCommonOuterBorderBorder;
    RadComboBoxItem item = radComboBox.Items.FirstOrDefault(x => x.Text.Equals("Name"));
    item.EnsureClickable();
    item.Select();

    and run into this errors:
    d:\work\qa\DECISION QA\Actions\Fact Type\New FT tab.tstest.cs: Line 103: (CS0104) 'RadComboBox' is an ambiguous reference between 'Telerik.WebAii.Controls.Html.RadComboBox' and 'Telerik.WebAii.Controls.Xaml.RadComboBox'
    d:\work\qa\DECISION QA\Actions\Fact Type\New FT tab.tstest.cs: Line 103: (CS0029) Cannot implicitly convert type 'ArtOfTest.WebAii.Silverlight.UI.Border' to 'Telerik.WebAii.Controls.Html.RadComboBox'
    d:\work\qa\DECISION QA\Actions\Fact Type\New FT tab.tstest.cs: Line 104: (CS0104) 'RadComboBoxItem' is an ambiguous reference between 'Telerik.WebAii.Controls.Html.RadComboBoxItem' and 'Telerik.WebAii.Controls.Xaml.RadComboBoxItem'
    d:\work\qa\DECISION QA\Actions\Fact Type\New FT tab.tstest.cs: Line 105: (CS1061) 'Telerik.WebAii.Controls.Html.RadComboBoxItem' does not contain a definition for 'EnsureClickable' and no extension method 'EnsureClickable' accepting a first argument of type 'Telerik.WebAii.Controls.Html.RadComboBoxItem' could be found (are you missing a using directive or an assembly reference?)
    d:\work\qa\DECISION QA\Actions\RFV\navigation tree.tstest.cs: Line 82: (CS0618) 'Telerik.WebAii.Controls.Xaml.RadTreeView.AllNodes' is obsolete: 'The property is deprecated. Please use AllNodesElements instead.'
  8. Cody
    Admin
    Cody avatar
    3360 posts

    Posted 31 May 2013 Link to this post

    Hello Adi,

    To correctly solve this problem it's important to know what type of application you're testing either Silverlight or HTML. I can tell from your code sample your application is Silverlight. In this case you need to remove this line of code from your code file:

    using Telerik.WebAii.Controls.Html;

    If you cannot see this line of code then click the View Class button. This will solve the errors for lines 103, 104, and 105.

    For line 82 simply replace "AllNodes" with "AllNodesElements" and now you should be all fixed.

    Let me know if you run into further problems and need more assistance.

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