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

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

3 Answers 116 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
randy
Top achievements
Rank 1
randy asked on 05 May 2011, 09:38 PM
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( ... );
            }
        });
    }
});

3 Answers, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 09 May 2011, 04:01 PM
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!
0
Naveen
Top achievements
Rank 1
answered on 15 Jan 2013, 06:50 PM
could you send me the article it is not opening.
0
Plamen
Telerik team
answered on 18 Jan 2013, 11:25 AM
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
Tags
General Discussions
Asked by
randy
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Naveen
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or