Selecting item in a custom infragistics combobox

Class library usage, coding and language questions.
ranoman
Posts: 26
Joined: Mon Jul 26, 2010 6:59 pm

Selecting item in a custom infragistics combobox

Post by ranoman » Thu Aug 19, 2010 4:32 am

I am having trouble selecting an item in a custom infragistics combobox. Ranorex is able to identify the combobox as well as the listitems using RanorexSpy, but it is not able to click on the combobox item. Below is a sample of the code I am using:

Code: Select all

Ranorex.ComboBox ranocombo= repo.Form.myComboBox;
ranocombo.ButtonOpen.Click();
Thread.Sleep(2000);
			
ListItem listitem= ranocombo.FindSingle<ListItem>("combobox/list/listitem[@accessiblename='ALA']"
Thread.Sleep(2000);
listitem.Focus();
listitem.Click();
I also tried the following code:

Code: Select all

 Ranorex.ComboBox comboBox = repo.Form.mycombobox;
comboBox.ButtonOpen.Click()
comboBox.SelectedItemText = ALA; 
The combobox gets opened, but I am not able to click the listitem. Like I said before Ranorex spy is able to get the values of all the list items, but I am not able to click on it. Any help with the same is much appreciated.

User avatar
artur_gadomski
Posts: 207
Joined: Mon Jul 19, 2010 6:55 am
Location: Copenhagen, Denmark
Contact:

Re: Selecting item in a custom infragistics combobox

Post by artur_gadomski » Thu Aug 19, 2010 7:12 am

Did you try selecting an item rather than focusing and clicking on it?
I know it's not the same as what a real user would do it but I find that it's more reliable and I never actually click on my combo boxes.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Selecting item in a custom infragistics combobox

Post by Support Team » Thu Aug 19, 2010 3:10 pm

Hi,
ranoman wrote:Below is a sample of the code I am using
Ranorex.ComboBox ranocombo= repo.Form.myComboBox;
ranocombo.ButtonOpen.Click();
Thread.Sleep(2000);
         
ListItem listitem= ranocombo.FindSingle<ListItem>("combobox/list/listitem[@accessiblename='ALA']"
Thread.Sleep(2000);
listitem.Focus();
listitem.Click();
Are you using this code inside your project or is this only a "sample" code and you use it in another way? I ask you, because this piece of code you posted won't compile. If you try to compile the code you get following error message "'Ranorex.ComboBox' does not contain a definition for 'ButtonOpen' and no extension method 'ButtonOpen' ...."
Please read following documentation about Ranorex Adapters
http://www.ranorex.com/support/user-gui ... apter.html

Would it also be possible to post us a Ranorex Snapshot of your control?
How to create a Ranorex Snapshot
http://www.ranorex.com/support/user-gui ... html#c2072

Thanks in advance.

Regards,
Peter
Ranorex Team

ranoman
Posts: 26
Joined: Mon Jul 26, 2010 6:59 pm

Re: Selecting item in a custom infragistics combobox

Post by ranoman » Fri Aug 20, 2010 2:55 am

Hello,
The code I posted is pseudo-code. In actual code3 I use it a different way.

I actually have the "Open" button stored in the repository and click on it and clicking on the open button works fine. It is clicking on the combo-box item that doesnt happen.

Please find attached the Ranorex snapshot as requested.

Thanks!
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Selecting item in a custom infragistics combobox

Post by Support Team » Fri Aug 20, 2010 8:50 am

Hi,

Have you tried Instant Tracking of Spy on a list item when the combo box is open?
http://www.ranorex.com/support/user-gui ... html#c1797

Mostly, when you open the combo box, the list items are not below the combo box. They are in a separate List or "Popup" window outside the combo box. Please also try to record the actions with the recorder and check the generated code. Maybe this will help you out.

Regards,
Peter
Ranorex Team