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

ComboBox.SelectedItem == null

5 Answers 398 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Martin asked on 29 Jul 2015, 02:17 PM

In our application we have several comboboxes and behavior of specific one is not fine for our automation tests (Teststack.White).

Description: combobox contains two values. When application starts then visibl​​e selected value is "value1" but in code, when I call

UIItem selectedItem = combobox.SelectedItem();

then selectedItem is null. When I call

combobox.Select("value1");
combobox.Select(0);

neither will take effect ("value1" is in combobox.Items[0] ). I need to call

combobox.Select(1);
combobox.Select(0);

and only now is everything ok. This will not work ​when I have single item in combobox and this solution is not what we want to have in our app. But the strangest part is that only this one combobox is behaving as is not expected.

Do you have any idea where could be a problem? If you need more specific information, don't hesitate to ask.

Thanks and regards, Martin

5 Answers, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 31 Jul 2015, 08:33 AM
Hello Martin,

Could you please confirm if your question is related to WPF's RadComboBox. From the provided code-snippets we notices methods like Select and SelectedItem that are not part of RadComboBox's API.

Could you share with us more details about your scenario in order for us to be able to assist you accordingly?

We are looking forward to hearing from you.

Regards,
Nasko
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Martin
Top achievements
Rank 1
answered on 31 Jul 2015, 02:10 PM

Hello Nasko,

well the situation is, that we really are using RadComboBox in a project but when implementing automation tests via TestStack.White, to control RadComboBox is not just straight forward.

I'll keep looking inside the project for more information and then ask a proper question again. Or if you have experienced automation testing using White, please let me know.

Best regards, Martin

0
Georgi
Telerik team
answered on 03 Aug 2015, 06:17 AM
Hello Martin,

We are not using TestStack.White, but it seems like in its basics it is using the UI Automation. So as the RadComboBox supports UI Automation and have implementation of AutomatuonPeers and specifically the Selection Control Pattern the issue you are facing seems strange.

Therefore as it seems like only the initial selected item is not recognized you can try to apply some refreshing of the RadComboBox. Also you can use the UISpy tool to check if the UI Automation is aware of the SelectedItem. Another approach would be to check if the same behavior can be reproduced with the Microsoft ComboBox.

Therefore if the UI Automation recognizes the SelectedItem and the issue can be reproduced with the MS ComboBox this could point that the issues is coming from the TestStack.White. If that is not the case, it would be helpful if you can provide a simple wpf application and a simple test that would help us to reproduce the issue.

Hope this would help.


Regards,
Georgi
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
GREESHMA
Top achievements
Rank 1
answered on 10 Dec 2019, 06:15 AM

Hi,

We are also facing the same issue - RadCombobox.SelectedItem returns null in spite of being selected or screen reloads. Do we have any resolution for this ?

0
Vladimir Stoyanov
Telerik team
answered on 12 Dec 2019, 11:56 AM

Hello,

If the suggestions provided by my colleague were not helpful in your scenario, may I ask you to share a sample project demonstrating the observed on your end behavior? This will hopefully allow us to replicate the same behavior and investigate it. 

You can open a new support ticket and attach the project there, since projects cannot be added to forum posts.

Regards,
Vladimir Stoyanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ComboBox
Asked by
Martin
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Martin
Top achievements
Rank 1
Georgi
Telerik team
GREESHMA
Top achievements
Rank 1
Vladimir Stoyanov
Telerik team
Share this question
or