Problem with Select input - jQuery .change and Select 'ByText'

4 posts, 0 answers
  1. randy
    randy avatar
    2 posts
    Member since:
    Jan 2011

    Posted 05 May 2011 Link to this post

    Hi,

    We have two select inputs on a page. The second is populated when something in the first select changes (using jQuery .change() to listen for that).

    We are trying to write tests for this page. In IE9, when we select something from the first list using "Select 'ByText' Option '<element in first select>' on '<name of first select>'", the .change() function never fires (even though the element does get selected), and the second select never gets populated with elements, which causes our test to fail.

    This works perfectly in all browsers when we test them by hand. When we run the test in Chrome it works fine. Below is the javascript.

    Any suggestions?

    $("#firstSelectObject").change(function () {    
        $("#secondSelectObject").empty();
            var parms = { ... };
            var serverUrl = ...;
            $.ajax({ url: serverUrl, traditional: true, type: "POST", dataType: "json", data: parms,
                success: function (result) {    
       
                                $.each(result, function(val, text) {
                                    addToSelectList(text);
    			    });
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert( ... );
                }
            });
        }
    });
  2. Anthony
    Admin
    Anthony avatar
    19 posts

    Posted 09 May 2011 Link to this post

    Hello Randy,

    jQuery events are not called automatically and must be fired manually. Please see this KB article for more information.

    Regards,
    Anthony
    the Telerik team
    Do you think you know all the new features coming out in Test Studio R1 2011? Think again - we have some surprises and will share them with you in the What's New in Test Studio R1 2011 Webinar on May 12th.
    Register Today!
  3. Naveen
    Naveen avatar
    4 posts
    Member since:
    Jun 2012

    Posted 15 Jan 2013 Link to this post

    could you send me the article it is not opening.
  4. Plamen
    Admin
    Plamen avatar
    8 posts

    Posted 18 Jan 2013 Link to this post

    Hi Naveen,

    Here's the article demonstrating how to trigger jQuery events manually in a coded step. If you are testing an HTML drop-down menu, you can do this without using code by setting the TriggerjQueryEvent property to True. This feature is available in our 2012 R2 SP1 release. See this article for more information. 

    Kind regards,
    Plamen
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top