Selecting value from RADCombobox

24 posts, 0 answers
  1. Darshana
    Darshana avatar
    14 posts
    Member since:
    Oct 2013

    Posted 19 Nov 2013 Link to this post

    Hi I am facing some challenges selecting value from Combobox. In recorded step it's only select value which is visible on the screen. I am attaching file for your reference. So in my combobox we have more than 2000 entity, from it I have to select 1 value. If you also help me how to write coded step for this that is really helpful as I am planning to write Coded step going forward.

    Thank you. 
  2. Mike
    Mike avatar
    9 posts
    Member since:
    Jun 2011

    Posted 21 Nov 2013 Link to this post

    I'd like some help with this as well.  I have a list of a variable number of items and I want to pick one at random.  I can't figure out how to do that ... yet.
  3. Steven
    Steven avatar
    9 posts
    Member since:
    Apr 2013

    Posted 22 Nov 2013 Link to this post

    Darshana, It looks like this is a Silverlight app; if that's not correct please let us know. Silverlight has a "feature" that it only puts in the visual tree what’s needed to render the UI at that time. The trick is to walk through the control, making all the elements visible - we have some documentation on doing just that.
  4. Steven
    Steven avatar
    9 posts
    Member since:
    Apr 2013

    Posted 22 Nov 2013 Link to this post

    Mike, Can you describe a bit what you're wanting to do here? Based on your question I'm pretty sure you're going to need to also use a coded step, similar to what's shown in this blog post and in the sample test project.
  5. Mike
    Mike avatar
    9 posts
    Member since:
    Jun 2011

    Posted 22 Nov 2013 Link to this post

    Sure thing, Steven.

    I checked out the post you cited and doing some coding is fine (though he picked C# and I would have been able to follow syntax better with Visual BASIC..but that's just me <g>).  I was something of a self-taught coder many (many!) years back and I enjoy it, so sharpening those skills again is indeed of interest to me.

    As for the particular screen I'm on, its for scheduling a class session.  One of the fields is to assign an Instructor for the class.  Depending on the selected class, there may be anywhere from two to 100 different Instructors populating the field.  So I'd like to have one selected at random from the Instructor field.
  6. Steven
    Steven avatar
    9 posts
    Member since:
    Apr 2013

    Posted 22 Nov 2013 Link to this post

    Mike,

    He is me in that case - thanks for the feedback, I'll try to remember to include both C# and VB examples in future posts.

    You should be able to use a random function to choose your data, no problem. In the grid example from the blog post, you could use a random number to select a row rather than looping through them. For a combobox, you could use a random number to select by index. The easy way to get started is by recording a test that chooses a specific choice. Then right-click on the test step and choose "Customize step in code." For a Telerik RADcontrols for ASP.NET combobox for example (from your other questions, I believe you're working with a web app rather than Silverlight), you'd get something like this

    Pages.ASPNETComboBoxDemo.ContentPlaceHolder1RadComboBox2Div.SelectItemByIndex(3);

    you'd then just want to change the index (3) to your random value.

    If you're not using Telerik controls, just straight-up HTML <select><option=...>, then you'll likely get a call to SelectByValue(). You can change that to SelectByIndex, again using your randomly-generated number.

    Random random = new Random();
    Pages.ALongDropdownList0.Select.SelectByIndex(random.Next(1, 3));


    Then you'll need to determine how to best verify the results of a randomly-generated selection, of course - if you don't know what the inputs will be then how will the test be able to know what to expect; that may be the more difficult part but relies on what exactly your app does and what you're looking to test.

    -Steven
     
     
  7. Darshana
    Darshana avatar
    14 posts
    Member since:
    Oct 2013

    Posted 22 Nov 2013 Link to this post

    Hey steven,

    Thanks for the reply. My application is web app and we are using telerik Controls fro Web app and for WPF Application. So Now in my app index value is keeps on changing as we add more and more values in Combobox. So what should I write to find that particular entity even if Value keeps on changing in the combobox. Also, If I want to make Combobox Data driven and Pass the value from Excel sheet, In Coded step How can I do?

    Let me know. Thank you.
  8. Steven
    Steven avatar
    9 posts
    Member since:
    Apr 2013

    Posted 22 Nov 2013 Link to this post

    Darshana, you'll want to do the same sort of thing as I showed Mike above, you'll just be changing from index to value - so you'll want to look for SelectItemByIndex() and change it to SelectItemByValue() instead.

    Pages.DemosOfTelerikSASPNET.ContentPlaceHolder1RadComboBoxRegionDiv.SelectItemByValue("Denver");

    You can use data-binding to connect an Excel spreadsheet to your project, then attach data columns to your coded or recorded steps.

    That might look something like this
    Pages.DemosOfTelerikSASPNET.ContentPlaceHolder1RadComboBoxRegionDiv.SelectItemByValue(Data["Col1"].ToString());


    -Steven
  9. Darshana
    Darshana avatar
    14 posts
    Member since:
    Oct 2013

    Posted 22 Nov 2013 Link to this post

    Hi Steven,

    I am sorry for asking so many questions. And I don't know whether these questions I should Write it here or put it another Post but since you are answering I want to ask all questions I have :)). I have a couple of questions:

    1) Combo filter :  In telerik when I set/enter any text in filter box, My page doesn't load while I am typing during the execution. Because of this my test fails.
    2) Click Away Functionality: One of the scenario in my web app, We enter a value in a textbox and I need to enter anywhere else in the screen to load that value in the text box. For this I have no idea how I perform automation for this.
    3) Multi column sorting(WPF Application) : For multi column sorting on RADGrid View , I have to do enter Shift and hit enter button. this is also challenging. I can try writing code for this. But don't know how to write:((.

    P.S : we are using Telerik Controls. 

    Thank you..
  10. Mario
    Admin
    Mario avatar
    8 posts

    Posted 27 Nov 2013 Link to this post

    Hello Darshana,

    Please allow me to interject and assist with these more technical issues.

    1) Could you clarify what exactly you mean by combo filter, I believe you are referring to a combobox which you can enter text and a list may be updated as you type, but it is important for me to fully understand before I can help. Knowing that your application uses Telerik controls, if it might be possible for you to find a similar example in our WPF Controls Examples demo, please let me know which example applies and I can come back to you with a test against it.

    2) To click away from a control you can record a "blind" mouse click (desktop action).

    3) Could you elaborate on what you mean by multi column sorting? Searching through a WPF RadGridView  for some specific entry would require some code, we have this code sample for the scenario.

    Regards,
    Mario
    Telerik
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  11. Darshana
    Darshana avatar
    14 posts
    Member since:
    Oct 2013

    Posted 29 Nov 2013 Link to this post

    Hi Mario,


    1) Could you clarify what exactly you mean by combo filter, I believe you are referring to a combobox which you can enter text and a list may be updated as you type.

    -- Yes You are correct. It would be great if you can help me how to write code for this one.
     
    2) To click away from a control you can record a "blind" mouse click (desktop action).
    -- Thanks I will try this one as well.

    3) Could you elaborate on what you mean by multi column sorting? Searching through a WPF RadGridView  for some specific entry would require some code, we have this code sample for the scenario.
    -- For our WPF application I have bunch of questions, is there a way we can start Private conversation?

    Thank You.
    Darshana 

  12. Mario
    Admin
    Mario avatar
    8 posts

    Posted 03 Dec 2013 Link to this post

    Hello Darshana,

    1) Unfortunately behavior of such controls can vary with every WPF application but I should not expect that you would need to write code for such a scenario, unless it is to work around some existing issue. As an example I attached a short video for dealing with the AutoCompleteBox from the Telerik WPF Controls Examples demo I mentioned in my last reply, however I am basically shooting in the dark since I have no reference for what this control in your application looks like or how it acts.

    2) Let me know how it goes.

    3) I would not be the resource for this type of consultation, you can certainly submit support tickets/form posts for such questions but if you wish to have a direct phone call or screen share it would have to be through either a sales representative or our paid Training sessions.

    Regards,
    Mario
    Telerik
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  13. Lisa
    Lisa avatar
    34 posts
    Member since:
    Nov 2017

    Posted 12 Dec 2017 Link to this post

    Is there any way to select a value from a RadComboBox using a partial string instead of the full string? Some details change in our DB regularly, but the beginning of the string we are selecting will always be the same. Either how to adjust the step in Test Studio, or how to make a coded step that does this is what I'm looking for.
  14. Elena Tsvetkova
    Admin
    Elena Tsvetkova avatar
    971 posts

    Posted 12 Dec 2017 Link to this post

    Hello Lisa,

    Thank you for reaching us out. 

    Please double check if the Text Content is used in the find expression of the elements in question. If so you could modify these to match only the beginning of the string. I hope this will be helpful to you. 

    Otherwise if you would need further assistance I would like to kindly ask you to elaborate more on the test script specifics you have. Thanks! 

    Regards,
    Elena Tsvetkova
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  15. Lisa
    Lisa avatar
    34 posts
    Member since:
    Nov 2017

    Posted 12 Dec 2017 in reply to Elena Tsvetkova Link to this post

    Hi Elena,

    Forgive the potential confusion, I'm still new to Telerik. Our RadComboBoxes are only defined using the id in the Element definition. Using the text in a combo box option seems a strange way to define the combo box. But I'm coming from the world of Selenium. If I'm following you correctly, you are suggesting using the InnerText contains 'somevalue'. The problem is that I'm seeing an innertext that shows the entire list of the names in the combobox. So if I do this, anchor the box to some value partial value that it contains, you think the RadComboBox will be able to match on a partial value? I've tried it, but it doesn't seem to work from what I can tell. I've attached a screenshot showing the inner text of the RadComboBox. I set the element to be defined by:

    id contains cboOffices

    InnerText contains CTM (I did not have it look for the value in question that we are trying to select because we need to do this in a datadriven way).

    Should I have tried to use the datadriven value in the definition?

  16. Elena Tsvetkova
    Admin
    Elena Tsvetkova avatar
    971 posts

    Posted 15 Dec 2017 Link to this post

    Hello Lisa,

    Thank you for the additional details. 

    Test Studio uses find logic to create expressions for locating the elements on page built on unique attributes of the elements. In many cases the text content is actually a reliable way to find an element. Also you could data drive the find expression itself. 

    As far as I understand you did not manage to select the required item from the combobox but I am currently unable to identify what might not be correct. While debugging you could use the annotations (point 5 in this article) while executing a test - this will highlight the target element for each step and will certainly ease you to understand what is going wrong. 

    Could you please create a sample test against that demo page which demonstrates your difficulties and attach it zipped to that thread for further inspection? Thanks!

    Regards,
    Elena Tsvetkova
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  17. Lisa
    Lisa avatar
    34 posts
    Member since:
    Nov 2017

    Posted 15 Dec 2017 in reply to Elena Tsvetkova Link to this post

    I think I've figured out the disconnect here.

    I do understand how to do the DataDriven find, what I do not understand is how this translates to the RadComboBox's selection logic choosing a partial value. If I'm not mistaken the find finds the entire RadComboBox which I can definitely make happen with a partial value that is data driven, but once it has done the find it still needs to do a selection from the combo box. It's doing that select using the data driven value that is failing.

    I tried to attach the solution I created with the test but it isn't attachable because it is too big. I am just sending you the data file and the webtest and hoping that will be enough. 

  18. Lisa
    Lisa avatar
    34 posts
    Member since:
    Nov 2017

    Posted 19 Dec 2017 in reply to Lisa Link to this post

    Elena? Did you manage to see my files?
  19. Elena Tsvetkova
    Admin
    Elena Tsvetkova avatar
    971 posts

    Posted 20 Dec 2017 Link to this post

    Hello Lisa,

    Thank you for the test provided. 

    I managed to review it and better understand the requirements you have for entering partial text. First I would like to mention that Test Studio provides at your disposal translators for the Telerik controls. These are available in IE only and you have probably recorded the test against that browser and thus the step RadComboBox Select. 

    Though to be able to enter part of text and filter the menu as per that text you would need to type the text in the input field without using the translator. Highlight the text field and locate the input in the DOM tree. Add a step to enter text to it and bind it to the data source. Please note that 'SimulateRealTyping' will be probably required to trigger the filtering. Please find a sample test attached to demonstrate the above description. 

    I hope this will be helpful to you! 

    Regards,
    Elena Tsvetkova
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  20. Lisa
    Lisa avatar
    34 posts
    Member since:
    Nov 2017

    Posted 20 Dec 2017 in reply to Elena Tsvetkova Link to this post

    So there is no input in our dom tree.
  21. Lisa
    Lisa avatar
    34 posts
    Member since:
    Nov 2017

    Posted 20 Dec 2017 in reply to Lisa Link to this post

    Please see the attached copy of our dom (id's obscured) vs yours.
  22. Lisa
    Lisa avatar
    34 posts
    Member since:
    Nov 2017

    Posted 20 Dec 2017 Link to this post

    Hang on, looking lower into our dom I might have found the input. Sorry for the extra messages, Ill tell you if it works.
  23. Lisa
    Lisa avatar
    34 posts
    Member since:
    Nov 2017

    Posted 20 Dec 2017 in reply to Lisa Link to this post

    Elena,

    Our dom is pretty ugly, but I did find the elements you indicated and tried the suggestion you had. Unfortunately typing didn't work, there isn't an input in both, but I managed to have it find the list element using partial text anyway.

    Thank you!

     

    Now I just need to figure out how to do table cells in a loop (I made a new post because our dom is really funky with the table structure).

  24. Elena Tsvetkova
    Admin
    Elena Tsvetkova avatar
    971 posts

    Posted 21 Dec 2017 Link to this post

    Hi Lisa,

    Thanks for keeping me updated on the progress. 

    I am glad to know you managed to find a proper solution for your scenario. I would also like to provide you our framework apis as you might need to use coded solutions to automate the application under test. It would probably be in use for you. 

    The other thread you have submitted was also addressed. 

    Thank you once again for your continuous cooperation! 

    Regards,
    Elena Tsvetkova
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
Back to Top