ComboBox.SelectedItem == null

4 posts, 0 answers
  1. Martin
    Martin avatar
    2 posts
    Member since:
    Jul 2015

    Posted 29 Jul 2015 Link to this post

    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

  2. Nasko
    Admin
    Nasko avatar
    587 posts

    Posted 31 Jul 2015 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Martin
    Martin avatar
    2 posts
    Member since:
    Jul 2015

    Posted 31 Jul 2015 in reply to Nasko Link to this post

    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

  5. Georgi
    Admin
    Georgi avatar
    349 posts

    Posted 03 Aug 2015 Link to this post

    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
Back to Top