Selecting value from RADCombobox

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