This is a migrated thread and some comments may be shown as answers.

RadComboBox SelectItem fails with long lists

7 Answers 140 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Joel
Top achievements
Rank 1
Joel asked on 09 Feb 2011, 09:04 PM
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

7 Answers, 1 is accepted

Sort by
0
Cody
Telerik team
answered on 10 Feb 2011, 12:49 AM
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
0
Joel
Top achievements
Rank 1
answered on 10 Feb 2011, 03:24 PM
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

 

0
Cody
Telerik team
answered on 10 Feb 2011, 05:58 PM
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
0
ABdul
Top achievements
Rank 1
answered on 08 Sep 2012, 02:25 PM
Where do you put this code. I am trying to select Country from the countries list and running into the same problem.
0
Cody
Telerik team
answered on 10 Sep 2012, 10:31 PM
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
0
Adi
Top achievements
Rank 1
answered on 30 May 2013, 11:36 AM
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.'
0
Cody
Telerik team
answered on 31 May 2013, 05:32 AM
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
Tags
General Discussions
Asked by
Joel
Top achievements
Rank 1
Answers by
Cody
Telerik team
Joel
Top achievements
Rank 1
ABdul
Top achievements
Rank 1
Adi
Top achievements
Rank 1
Share this question
or